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

View File

@ -299,6 +299,11 @@ class User extends CommonObject
*/ */
public $nb_rights; public $nb_rights;
/**
* @var array To store list of groups of user (used by API /info for example)
*/
public $user_group_list;
/** /**
* @var array Cache array of already loaded permissions * @var array Cache array of already loaded permissions
*/ */