Skip to content

Commit

Permalink
get roles
Browse files Browse the repository at this point in the history
  • Loading branch information
regisoc committed Feb 15, 2024
1 parent f4c5186 commit 5bc64cd
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions php/libraries/User.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -629,24 +629,24 @@ class User extends UserPermissions implements
// return false;
// }

// /**
// * Get the roles this user has access to.
// *
// * @return array an array with role values.
// */
// public function getRoles(): array
// {
// $db = \NDB_Factory::singleton()->database();
// return $db->pselect(
// "SELECT
// r.RoleID,
// r.Code,
// r.Name,
// r.Description
// FROM user_role_rel urr
// JOIN roles r ON (urr.RoleID = r.RoleID)
// WHERE urr.userID = :userid",
// ['userid' => $this->getId()]
// );
// }
/**
* Get the roles this user has access to.
*
* @return array an array with role values.
*/
public function getRoles(): array
{
$db = \NDB_Factory::singleton()->database();
return $db->pselect(
"SELECT
r.RoleID,
r.Code,
r.Name,
r.Description
FROM user_role_rel urr
JOIN roles r ON (urr.RoleID = r.RoleID)
WHERE urr.userID = :userid",
['userid' => $this->getId()]
);
}
}

0 comments on commit 5bc64cd

Please sign in to comment.