2
0
forked from Wavyzz/dolibarr

Fix scrutinizer

This commit is contained in:
Laurent Destailleur
2021-06-05 01:17:16 +02:00
parent 5d063ab880
commit 3e53ab5bfe
2 changed files with 7 additions and 4 deletions

View File

@@ -248,8 +248,8 @@ class Users extends DolibarrApi
*
* @url GET /info
*
* @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose)
* @return array|mixed Data without useless information
* @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose)
* @return array|mixed Data without useless information
*
* @throws RestException 401 Insufficient rights
* @throws RestException 404 User or group not found
@@ -371,11 +371,9 @@ class Users extends DolibarrApi
if ($field == 'pass') {
if ($this->useraccount->id != DolibarrApiAccess::$user->id && empty(DolibarrApiAccess::$user->rights->user->user->password)) {
throw new RestException(401, 'You are not allowed to modify password of other users');
continue;
}
if ($this->useraccount->id == DolibarrApiAccess::$user->id && empty(DolibarrApiAccess::$user->rights->user->self->password)) {
throw new RestException(401, 'You are not allowed to modify your own password');
continue;
}
}
if (DolibarrApiAccess::$user->admin) { // If user for API is admin