From 70c88eeef866fd99366a8343bd9f663ff15a3bab Mon Sep 17 00:00:00 2001 From: Eric Bremner <ebremner@uwaterloo.ca> Date: Fri, 23 Jul 2021 15:18:21 +0000 Subject: [PATCH] ISTWCMS-4954: updating roles class to get all labels and all role ids --- src/UwRoles/UwRoles.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/UwRoles/UwRoles.php b/src/UwRoles/UwRoles.php index a555901d..c64c5658 100644 --- a/src/UwRoles/UwRoles.php +++ b/src/UwRoles/UwRoles.php @@ -60,6 +60,24 @@ class UwRoles { ]; } + /** + * Gets all the role ids in the system, UW and Drupal. + * + * @return array + * Array of all role ids. + */ + public static function getAllRoles(): array { + + // Get the UW roles. + $roles = UwRoles::getUwRoleIds(); + + // Append the Drupal roles. + $roles = array_merge($roles, UwRoles::getDrupalRoleIds()); + + // Return all the roles. + return $roles; + } + /** * Gets the label for a UW role. * @@ -90,6 +108,12 @@ class UwRoles { case 'uw_role_form_results_access': return 'Form results access'; + case 'anonymous': + return 'Anonymous'; + + case 'authenticated': + return 'Authenticated'; + default: return ''; } -- GitLab