Skip to content

Commit a62fd5f

Browse files
author
horfic
committed
Deleted the client id check, now he goes directly to the sysuser_id. Now you don't have to use the client id anymore, only more the sysuser_id. Solves issue when client has more than one sysuser
1 parent 2c1c662 commit a62fd5f

File tree

1 file changed

+25
-31
lines changed

1 file changed

+25
-31
lines changed

interface/lib/classes/remoting_lib.inc.php

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -139,37 +139,31 @@ function loadFormDef($file) {
139139

140140
//* Load the user profile
141141
function loadUserProfile($client_id = 0) {
142-
global $app,$conf;
143-
144-
$client_id = intval($client_id);
145-
146-
if($client_id == 0) {
147-
$this->sys_username = 'admin';
148-
$this->sys_userid = 1;
149-
$this->sys_default_group = 1;
150-
$this->sys_groups = 1;
151-
} else {
152-
//* Load the client data
153-
$client = $app->db->queryOneRecord("SELECT username FROM client WHERE client_id = $client_id");
154-
if($client["username"] == '') {
155-
$this->errorMessage .= 'No client with ID $client_id found.';
156-
return false;
157-
}
158-
//* load system user
159-
$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE username = '".$app->db->quote($client["username"])."'");
160-
if(empty($user["userid"])) {
161-
$this->errorMessage .= 'No user with the username '.$client['username'].' found.';
162-
return false;
163-
}
164-
$this->sys_username = $user['username'];
165-
$this->sys_userid = $user['userid'];
166-
$this->sys_default_group = $user['default_group'];
167-
$this->sys_groups = $user['groups'];
168-
}
169-
170-
return true;
171-
172-
}
142+
global $app,$conf;
143+
144+
$client_id = intval($client_id);
145+
146+
if($client_id == 0) {
147+
$this->sys_username = 'admin';
148+
$this->sys_userid = 1;
149+
$this->sys_default_group = 1;
150+
$this->sys_groups = 1;
151+
} else {
152+
//* load system user
153+
$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE sysuser_id = $client_id");
154+
if(empty($user["userid"])) {
155+
$this->errorMessage .= 'No sysuser with the ID $client_id found.';
156+
return false;
157+
}
158+
$this->sys_username = $user['username'];
159+
$this->sys_userid = $user['userid'];
160+
$this->sys_default_group = $user['default_group'];
161+
$this->sys_groups = $user['groups'];
162+
}
163+
164+
return true;
165+
166+
}
173167

174168

175169
/**

0 commit comments

Comments
 (0)