#1 (permalink)  
Old 06-29-2009, 02:43 AM
lvt lvt is offline
Registered User
 
Join Date: May 2009
Posts: 33
lvt is on a distinguished road
MysqlFE::userdbprivs() syntax

Can you please tell me the complete syntax of this function ? I tried with an user having several privileges but the API only returns one.

Here is the XML result :

Quote:
<cpanelresult>
<apiversion>2</apiversion>
<data>
<ALTER>1</ALTER>
</data>
<func>userdbprivs</func>
<module>MysqlFE</module>
</cpanelresult>
How to use this function to show a full list of privileges ?

My API call is the following

PHP Code:
<cpanelaction><module>MysqlFE</module><func>userdbprivs</func><apiversion>2</apiversion><args><user>{$info['user']}</user><db>{$info['db']}</db></args></cpanelaction
Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-29-2009, 12:52 PM
cPanelDavidG's Avatar
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 7,995
cPanelDavidG is on a distinguished road
Quote:
Originally Posted by lvt View Post
Can you please tell me the complete syntax of this function ? I tried with an user having several privileges but the API only returns one.

Here is the XML result :



How to use this function to show a full list of privileges ?

My API call is the following

PHP Code:
<cpanelaction><module>MysqlFE</module><func>userdbprivs</func><apiversion>2</apiversion><args><user>{$info['user']}</user><db>{$info['db']}</db></args></cpanelaction
Thanks.
Your function call is returning all privileges for me. Are you seeing this user as having all privileges via the cPanel interface?
__________________
Want our technical analysts to login to your server to assist you? You can contact our technical analysts at: http://tickets.cPanel.net/submit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-29-2009, 03:31 PM
lvt lvt is offline
Registered User
 
Join Date: May 2009
Posts: 33
lvt is on a distinguished road
Quote:
Originally Posted by cPanelDavidG View Post
Your function call is returning all privileges for me. Are you seeing this user as having all privileges via the cPanel interface?
You're right, this function works fine, thanks to your suggestion I use the cPanel interface to check and I see that the API function "adduserdb" doesn't work at all. Some days ago I posted an entry about this problem here :

http://forums.cpanel.net/developer-c...tml#post531025

I think it worked but it was just an inlusion, it only works with "ALL" option, any other input will fails.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-29-2009, 03:41 PM
lvt lvt is offline
Registered User
 
Join Date: May 2009
Posts: 33
lvt is on a distinguished road
Let's do some tests

#1

PHP Code:
<cpanelaction><module>Mysql</module><func>adduserdb</func><apiversion>1</apiversion><args>{$info['db']}</args><args>{$info['user']}</args><args>ALL</args></cpanelaction
OK I have ALL checked, no problem here.

#2

PHP Code:
<cpanelaction><module>Mysql</module><func>adduserdb</func><apiversion>1</apiversion><args>{$info['db']}</args><args>{$info['user']}</args><args>INSERT DELETE</args></cpanelaction
This query failed !

#3

PHP Code:
<cpanelaction><module>Mysql</module><func>adduserdb</func><apiversion>1</apiversion><args>{$info['db']}</args><args>{$info['user']}</args><args>INSERTDELETE</args></cpanelaction
For this #3 (no space between values) I only have the "DELETE" value checked.

So how can I do to use this API properly ? Because it's important to not to give all privileges to anyone as it poses some security risk. Most of users will only need "INSERT SELECT UPDATE DELETE".

Last edited by lvt; 06-29-2009 at 03:45 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-29-2009, 03:56 PM
cPanelDavidG's Avatar
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 7,995
cPanelDavidG is on a distinguished road
Code:
https://SERVER:2083/xml-api/cpanel?user=cPanelUser&xmlin=<cpanelaction> <module>Mysql</module><func>adduserdb</func><apiversion>1</apiversion><args>cpanel_DB</args><args>cpanel_USER</args><args>INSERT DELETE</args></cpanelaction>
Works for me.

Acceptable values are as follows:

ALL SELECT CREATE INSERT ALTER UPDATE DROP DELETE LOCK INDEX REFERENCES CREATETEMPORARYTABLES

The X3 interface places spaces between these values and uses these values in the above order.
__________________
Want our technical analysts to login to your server to assist you? You can contact our technical analysts at: http://tickets.cPanel.net/submit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 06-29-2009, 04:50 PM
lvt lvt is offline
Registered User
 
Join Date: May 2009
Posts: 33
lvt is on a distinguished road
Quote:
Originally Posted by cPanelDavidG View Post
Code:
https://SERVER:2083/xml-api/cpanel?user=cPanelUser&xmlin=<cpanelaction> <module>Mysql</module><func>adduserdb</func><apiversion>1</apiversion><args>cpanel_DB</args><args>cpanel_USER</args><args>INSERT DELETE</args></cpanelaction>
Works for me.

Acceptable values are as follows:

ALL SELECT CREATE INSERT ALTER UPDATE DROP DELETE LOCK INDEX REFERENCES CREATETEMPORARYTABLES

The X3 interface places spaces between these values and uses these values in the above order.
Can you please test with the following cPanel version ?

11.24.4-RELEASE
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 06-29-2009, 05:46 PM
cPanelDavidG's Avatar
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 7,995
cPanelDavidG is on a distinguished road
I'll provision a server with the latest RELEASE tonight, should be able to test on it when I'm back in the office tomorrow .
__________________
Want our technical analysts to login to your server to assist you? You can contact our technical analysts at: http://tickets.cPanel.net/submit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 06-30-2009, 02:27 AM
lvt lvt is offline
Registered User
 
Join Date: May 2009
Posts: 33
lvt is on a distinguished road
Quote:
Originally Posted by cPanelDavidG View Post
I'll provision a server with the latest RELEASE tonight, should be able to test on it when I'm back in the office tomorrow .
Thanks David
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 06-30-2009, 11:44 AM
cPanelDavidG's Avatar
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 7,995
cPanelDavidG is on a distinguished road
Quote:
Originally Posted by lvt View Post
Thanks David
It's still working for me on:

cPanel 11.24.4-R36167 - WHM 11.24.2 - X 3.9
CENTOS 4.7 i686 standard
__________________
Want our technical analysts to login to your server to assist you? You can contact our technical analysts at: http://tickets.cPanel.net/submit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 07-01-2009, 12:32 AM
lvt lvt is offline
Registered User
 
Join Date: May 2009
Posts: 33
lvt is on a distinguished road
Quote:
Originally Posted by cPanelDavidG View Post
It's still working for me on:

cPanel 11.24.4-R36167 - WHM 11.24.2 - X 3.9
CENTOS 4.7 i686 standard
With your prompt support I have solved the problem, in fact, cPanel's APIs don't accept spaces between argument values so we need to replace all spaces by "%20" (as urlencode() usually does).

Thanks again.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Syntax help distinctedge cPanel and WHM Discussions 6 07-15-2008 04:13 PM
syntax error hassnetwork cPanel Newbies 3 01-18-2006 10:09 AM
Syntax Mismatch ProLamer cPanel and WHM Discussions 1 08-24-2005 12:49 AM
What would this syntax be? Izkabola cPanel and WHM Discussions 2 07-04-2005 04:40 PM
Please use the this syntax wwwacct StandBy1 cPanel and WHM Discussions 10 03-07-2004 02:08 PM


All times are GMT -5. The time now is 11:16 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© cPanel Inc