From 4338a06e4ac1808f7872a31338e35a6f3a381ae1 Mon Sep 17 00:00:00 2001 From: Till Brehm Date: Tue, 30 May 2017 10:20:09 +0200 Subject: [PATCH] Add function is_client_of_reseller($userid) to check if a client belongs to a reseller. --- interface/lib/classes/auth.inc.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/interface/lib/classes/auth.inc.php b/interface/lib/classes/auth.inc.php index 9c52f5097c..6658c4c116 100644 --- a/interface/lib/classes/auth.inc.php +++ b/interface/lib/classes/auth.inc.php @@ -64,6 +64,20 @@ class auth { return false; } } + + // Function to check if a client belongs to a reseller + public function is_client_of_reseller($userid = 0) { + global $app, $conf; + + if($userid == 0) $userid = $_SESSION['s']['user']['userid']; + + $client = $app->db->queryOneRecord("SELECT client.sys_userid, client.sys_groupid FROM sys_user, client WHERE sys_user.userid = ? AND sys_user.client_id = client.client_id", $userid); + if($client['sys_userid'] > 1 || $client['sys_groupid'] > 1) { + return true; + } else { + return false; + } + } //** This function adds a given group id to a given user. public function add_group_to_user($userid, $groupid) { -- GitLab