HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Developers' Forum (http://www.howtoforge.com/forums/forumdisplay.php?f=33)
-   -   getting client_id from ISPConfig API (http://www.howtoforge.com/forums/showthread.php?t=54961)

dgmufasa 16th November 2011 15:53

getting client_id from ISPConfig API
 
Hello,

In many of the ISPConfig functions, a "client_id" is needed for use. For example, in the "add_client" functionality, there is an option to enter "parent_id".

How can one get this parent_id from the ISPConfig user interface?

What function can one execute to get it?

Is one supposed to query the client DB table directly to get it?

TIA

till 16th November 2011 15:58

See function client_get_id($sys_userid) in API docs. Please post API and dev related questions in the Developer forum.

dgmufasa 16th November 2011 16:19

Thanks again for the response.

At first, I was doing a select on the "client" table and using the "client_id" directly.

Can you please confirm that this would/could not work?

Also, it is my understanding that the sys_userid is the "system id" of the person currently logged in.

How would this work in the case of a remote user (since this is required to use the API to begin with) - or - am I missing something?

TIA

till 16th November 2011 16:26

Quote:

At first, I was doing a select on the "client" table and using the "client_id" directly.
Thats absolutely ok and the preferred way.

Quote:

Also, it is my understanding that the sys_userid is the "system id" of the person currently logged in.
Thats correct too.

Quote:

How would this work in the case of a remote user (since this is required to use the API to begin with) - or - am I missing something?
Quote:

Remote users are no ispconfig users, they dont exist in the permission scheme. A remote user is only there to restrict the access to the remote api.
All functions that get executed by a remote user have admin permissions. So basically the remote user is a ISPConfig administrator.

The client_get_id function is used when you need to know which client owns a record. E.g. you querid ispconfig for a mail domain and you want to know the owner of that domain.

dgmufasa 17th November 2011 15:48

Is this something that would work to get the correct client_id? When querying direct from the DB, the other functionality is still not working -so - I am thinking of trying this approach.

Can you confirm whether or not it would get the needed data?


$record_record = $client->client_get_by_username($session_id, $username);

$sysuserid = $record_record['userid'];

$sys_userid = $sysuserid;

$client_record = $client->client_get_id($session_id, $sys_userid);



Also, I must have some kind of different version because I see:
client_get
client_get_by_username
client_get_id
client_get_sites_by_user

till 17th November 2011 15:55

Yes. But you can make the code more simple:

$sys_user_record = $client->client_get_by_username($session_id, $username);
$client_record = $client->client_get_id($session_id, $sys_user_record['userid']);


All times are GMT +2. The time now is 12:45.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.