From 5bc64cd09677c2539ede367db8fb0aed2afee059 Mon Sep 17 00:00:00 2001 From: regisoc Date: Thu, 15 Feb 2024 08:55:01 -0500 Subject: [PATCH] get roles --- php/libraries/User.class.inc | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/php/libraries/User.class.inc b/php/libraries/User.class.inc index 430fb5d66bc..6782f3c87fb 100644 --- a/php/libraries/User.class.inc +++ b/php/libraries/User.class.inc @@ -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()] + ); + } }