Hi Elia,
The issue you're probably facing has to do with a bug in the xmlapi PHP client class. Because the xmlapi parser is looking for 'user' concerning the cpanel account AND the function requires a parameter of 'user' concerning the database user, the xmlapi PHP client class version 1.0.5 would clobber them and only send one.
If you get the latest version of the xmlapi class (v1.0.6, found here: http://sdk.cpanel.net/lib/xmlapi/php..._v1.0.6.tar.gz ) your issue will probably dissipate. We now send 'cpanel_xmlapi_user' to address the xmlapi parser's needs.
The following works for me with v1.0.6
Code:
// authenticating as root on port 2087
include("xmlapi.php");
$ip = "10.1.1.1";
$root_pass = "S3cretP4ss";
$account['username'] = "elia";
$args['db'] = 'elia_e1';
$args['user'] = 'elia_eu1';
$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("root",$root_pass);
$xmlapi->set_port('2087');
$xmlapi->set_output('xml');
$xmlapi->set_debug(1);
$xmlapi->api2_query($account['username'], "MysqlFE", "userdbprivs", $args );
OR
Code:
// authenticating as user on port 2083
include("xmlapi.php");
$ip = "10.1.1.1";
$account['username'] = "elia";
$account['password'] = '3ll4Secret';
$args['db'] = 'elia_e1';
$args['user'] = 'elia_eu1';
$xmlapi = new xmlapi($ip);
$xmlapi->password_auth($account['username'], $account['password']);
$xmlapi->set_port('2083');
$xmlapi->set_output('xml');
$xmlapi->set_debug(1);
$xmlapi->api2_query($account['username'], "MysqlFE", "userdbprivs", $args );
Both give the same result:
Code:
DATA: db=elia_e1&user=elia_eu1&cpanel_xmlapi_user=elia&cpanel_xmlapi_module=MysqlFE&cpanel_xmlapi_func=userdbprivs&cpanel_xmlapi_apiversion=2
RESPONSE:
<cpanelresult>
<apiversion>2</apiversion>
<data>
<ALTER>1</ALTER>
<CREATE>1</CREATE>
<DELETE>1</DELETE>
<DROP>1</DROP>
<SELECT>1</SELECT>
</data>
<event>
<result>1</result>
</event>
<func>userdbprivs</func>
<module>MysqlFE</module>
<postevent>
<result>1</result>
</postevent>
<preevent>
<result>1</result>
</preevent>
</cpanelresult>
Regards,
-DavidN