Skip to content

Commit 4338a06

Browse files
author
Till Brehm
committed
Add function is_client_of_reseller($userid) to check if a client belongs to a reseller.
1 parent 665999f commit 4338a06

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

interface/lib/classes/auth.inc.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,20 @@ public function has_clients($userid) {
6464
return false;
6565
}
6666
}
67+
68+
// Function to check if a client belongs to a reseller
69+
public function is_client_of_reseller($userid = 0) {
70+
global $app, $conf;
71+
72+
if($userid == 0) $userid = $_SESSION['s']['user']['userid'];
73+
74+
$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);
75+
if($client['sys_userid'] > 1 || $client['sys_groupid'] > 1) {
76+
return true;
77+
} else {
78+
return false;
79+
}
80+
}
6781

6882
//** This function adds a given group id to a given user.
6983
public function add_group_to_user($userid, $groupid) {

0 commit comments

Comments
 (0)