Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Developers' Forum

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 16th November 2011, 15:53
dgmufasa dgmufasa is offline
Member
 
Join Date: Oct 2011
Posts: 86
Thanks: 5
Thanked 1 Time in 1 Post
Default 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
Reply With Quote
Sponsored Links
  #2  
Old 16th November 2011, 15:58
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,504
Thanks: 813
Thanked 5,265 Times in 4,129 Posts
Default

See function client_get_id($sys_userid) in API docs. Please post API and dev related questions in the Developer forum.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 16th November 2011, 16:19
dgmufasa dgmufasa is offline
Member
 
Join Date: Oct 2011
Posts: 86
Thanks: 5
Thanked 1 Time in 1 Post
Default

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
Reply With Quote
  #4  
Old 16th November 2011, 16:26
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,504
Thanks: 813
Thanked 5,265 Times in 4,129 Posts
Default

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.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 17th November 2011, 15:48
dgmufasa dgmufasa is offline
Member
 
Join Date: Oct 2011
Posts: 86
Thanks: 5
Thanked 1 Time in 1 Post
Default

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
Reply With Quote
  #6  
Old 17th November 2011, 15:55
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,504
Thanks: 813
Thanked 5,265 Times in 4,129 Posts
 
Default

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']);
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
Reply

Bookmarks

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Relay access denied when using SMTP to external recipients Kamran Shah Installation/Configuration 111 14th May 2014 18:10
chroot SSH IspConfig2 kextra1 General 4 20th January 2011 18:41
ISPConfig 3.0.3.1 API holykim Developers' Forum 4 16th December 2010 14:10
ISPConfig 3.0.1 released till General 36 29th March 2009 14:30
SP-Server Setup - Ubuntu 5.10 "Breezy Badger" - Page 6 (changes) LuisC-SM HOWTO-Related Questions 0 21st April 2006 15:16


All times are GMT +2. The time now is 08:24.


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