Merge pull request #15568 from ptibogxiv/patch-395
New get permissions for connected user by API
This commit is contained in:
commit
c03f43d5f0
@ -246,12 +246,13 @@ 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)
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
public function getInfo()
|
public function getInfo($includepermissions = 0)
|
||||||
{
|
{
|
||||||
$apiUser = DolibarrApiAccess::$user;
|
$apiUser = DolibarrApiAccess::$user;
|
||||||
|
|
||||||
@ -264,6 +265,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();
|
||||||
|
}
|
||||||
|
|
||||||
$usergroup = new UserGroup($this->db);
|
$usergroup = new UserGroup($this->db);
|
||||||
$userGroupList = $usergroup->listGroupsForUser($apiUser->id, false);
|
$userGroupList = $usergroup->listGroupsForUser($apiUser->id, false);
|
||||||
if (!is_array($userGroupList)) {
|
if (!is_array($userGroupList)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user