Skip to content

Commit 770b83b

Browse files
committed
Added a function to retrieve the client_id for a given sysuser_id to the remotting API: client_get_id($session_id,$sys_userid);
1 parent 4787bc1 commit 770b83b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

interface/lib/classes/remoting.inc.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,26 @@ public function client_get($session_id, $client_id)
893893
return $app->remoting_lib->getDataRecord($client_id);
894894
}
895895

896+
public function client_get_id($session_id, $sys_userid)
897+
{
898+
global $app;
899+
if(!$this->checkPerm($session_id, 'client_get')) {
900+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
901+
return false;
902+
}
903+
904+
$sys_userid = intval($sys_userid);
905+
906+
$rec = $app->db->queryOneRecord("SELECT client_id FROM sys_user WHERE userid = ".$sys_userid);
907+
if(isset($rec['client_id'])) {
908+
return intval($rec['client_id']);
909+
} else {
910+
$this->server->fault('no_client_found', 'There is no sysuser account for this client ID.');
911+
return false;
912+
}
913+
914+
}
915+
896916

897917
public function client_add($session_id, $reseller_id, $params)
898918
{

0 commit comments

Comments
 (0)