From 770b83bc62c614868d924570b1b89f2a7da1807f Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Mon, 01 Mar 2010 05:30:18 -0500
Subject: [PATCH] Added a function to retrieve the client_id for a given sysuser_id to the remotting API: client_get_id($session_id,$sys_userid);

---
 interface/lib/classes/remoting.inc.php |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index 8aeabc3..19e4e3f 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -893,6 +893,26 @@
 		return $app->remoting_lib->getDataRecord($client_id);
 	}
 	
+	public function client_get_id($session_id, $sys_userid)
+    {
+		global $app;
+		if(!$this->checkPerm($session_id, 'client_get')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		
+		$sys_userid = intval($sys_userid);
+		
+		$rec = $app->db->queryOneRecord("SELECT client_id FROM sys_user WHERE userid = ".$sys_userid);
+		if(isset($rec['client_id'])) {
+			return intval($rec['client_id']);
+		} else {
+			$this->server->fault('no_client_found', 'There is no sysuser account for this client ID.');
+			return false;
+		}
+		
+	}
+	
 	
 	public function client_add($session_id, $reseller_id, $params)
 	{

--
Gitblit v1.9.1