This commit is contained in:
Laurent Destailleur 2020-02-03 03:47:45 +01:00
parent a30da7860f
commit b3a50bd4b0

View File

@ -132,15 +132,15 @@ class Users extends DolibarrApi
/** /**
* Get properties of an user object * Get properties of an user object
*
* Return an array with user informations * Return an array with user informations
* *
* @param int $id ID of user * @param int $id ID of user
* @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 * @throws RestException
*/ */
public function get($id) public function get($id, $includepermissions = 0)
{ {
//if (!DolibarrApiAccess::$user->rights->user->user->lire) { //if (!DolibarrApiAccess::$user->rights->user->user->lire) {
//throw new RestException(401); //throw new RestException(401);
@ -157,6 +157,10 @@ class Users extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
if ($includepermissions) {
$this->useraccount->getRights();
}
return $this->_cleanObjectDatas($this->useraccount); return $this->_cleanObjectDatas($this->useraccount);
} }
@ -544,6 +548,12 @@ class Users extends DolibarrApi
unset($object->clicktodial_password); unset($object->clicktodial_password);
unset($object->openid); unset($object->openid);
unset($object->lines);
unset($object->modelpdf);
unset($object->skype);
unset($object->twitter);
unset($object->facebook);
unset($object->linkedin);
$canreadsalary = ((!empty($conf->salaries->enabled) && !empty(DolibarrApiAccess::$user->rights->salaries->read)) $canreadsalary = ((!empty($conf->salaries->enabled) && !empty(DolibarrApiAccess::$user->rights->salaries->read))
|| (!empty($conf->hrm->enabled) && !empty(DolibarrApiAccess::$user->rights->hrm->employee->read))); || (!empty($conf->hrm->enabled) && !empty(DolibarrApiAccess::$user->rights->hrm->employee->read)));