The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

cPanel API MysqlFE::setdbuserprivileges

Discussion in 'cPanel Developers' started by mattpeters, Sep 20, 2014.

  1. mattpeters

    mattpeters Registered

    Joined:
    Sep 20, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    Hi,
    I new to working with the API but I setup a few functions that are all working correctly with the with the xmlapi. I can't seem to get MysqlFE::setdbuserprivileges to work. I couldn't find documentation on what to set for 'privs'. The best I found was some references from v1. It gives me a success message no matter what I put in for 'privs' but all it will do is clear out the privileges that are there.

    Code:
    $xmlapi->api2_query($this->user, "MysqlFE", "setdbuserprivileges",array('privs'=>"all",'db'=>$dbname,'dbuser'=>$user));

    Should this code be working or are there other settings for 'privs' available?

    Thanks,
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  3. mattpeters

    mattpeters Registered

    Joined:
    Sep 20, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    Hi,
    Can you tell me how the 'privs' field is supposed to be constructed? It's not detailed there.

    I tried multiple different ways (example: 'ALTER','alter','all','ALL PRIVILEGES') with no success. It will clear out the privileges that are there so I'm assuming I got the call right.

    Thanks,
     
  4. pguilbault

    pguilbault Registered

    Joined:
    Sep 25, 2014
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
  5. rigiddesign

    rigiddesign Registered

    Joined:
    Mar 14, 2013
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Have any of you guys found a solution. It simply says it's a string but no example of how to construct it!! I have tried similar to you guys but not found a solution?
     
  6. mattpeters

    mattpeters Registered

    Joined:
    Sep 20, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    No, I never did find a solution. It's kind of sad too because I know the function works (because it clears out privileges you have set before) but there's no documentation on what parameters to send.
     
  7. rigiddesign

    rigiddesign Registered

    Joined:
    Mar 14, 2013
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Stupid ain't it. Yeah it does something as it assigns the user ot the database, just sets no privileges!
     
  8. cPAndrewHodge

    cPAndrewHodge cPanel UI Developer
    Staff Member

    Joined:
    Dec 10, 2012
    Messages:
    52
    Likes Received:
    3
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Let me know if this is helpful, after a quick glance at the code this is what it appears to map against.

    my %_api1_privilege_mappings = (
    'ALL PRIVILEGES' => 'all',
    'CREATE ROUTINE' => 'routine',
    'CREATE TEMPORARY TABLES' => 'temporary',
    'CREATE VIEW' => 'createview',
    'LOCK TABLES' => 'lock',
    'SHOW VIEW' => 'showview',
    );

    Edit: Also, try 'privileges' instead of 'privs'. Just a hunch(my $privs = $OPTS{'privileges'}) but I think we might have gotten documentation a little mixed up.
     
  9. cPLaurenceS

    cPLaurenceS cPanel Staff - Technical Writer II (Cobra)
    Staff Member

    Joined:
    Oct 30, 2012
    Messages:
    40
    Likes Received:
    3
    Trophy Points:
    8
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hi there!

    Yes, it's an error in the documentation. The parameter should be privileges instead of privs.

    I've gone ahead and corrected it.

    My apologies for the error and any problems that it has caused. Thank you for letting us know there was something amiss.

    If you notice any other issues in the documentation, please let us know through the documentation feedback at the bottom of the page, or file a case through one of our Support agents.

    Thanks,
    -ls
    Laurence Simon
    Technical Writer
    cPanel, Inc.
     
  10. mattpeters

    mattpeters Registered

    Joined:
    Sep 20, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    Sorry I'm a bit late getting back on this, but thanks for following up and researching that. It makes sense now because I was pretty much brute forcing the privs param with no result.

    Thanks,
     
Loading...

Share This Page