From 0cfa744fd97b676f2a5b4325229dcee239f38e30 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Tue, 16 Jun 2020 22:38:46 +0100 Subject: [PATCH] MDL-63387 user: show both role names on course participants page. --- user/classes/output/participants_filter.php | 4 ++-- user/classes/output/user_roles_editable.php | 4 ++-- user/classes/table/participants.php | 7 +++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/user/classes/output/participants_filter.php b/user/classes/output/participants_filter.php index 443c5a280e2..17dd34c2b04 100644 --- a/user/classes/output/participants_filter.php +++ b/user/classes/output/participants_filter.php @@ -129,10 +129,10 @@ class participants_filter implements renderable, templatable { protected function get_roles_filter(): ?stdClass { $roles = []; $roles += [-1 => get_string('noroles', 'role')]; - $roles += get_viewable_roles($this->context); + $roles += get_viewable_roles($this->context, null, ROLENAME_BOTH); if (has_capability('moodle/role:assign', $this->context)) { - $roles += get_assignable_roles($this->context, ROLENAME_ALIAS); + $roles += get_assignable_roles($this->context, ROLENAME_BOTH); } return $this->get_filter_object( diff --git a/user/classes/output/user_roles_editable.php b/user/classes/output/user_roles_editable.php index 4ee19611b61..cc75328a899 100644 --- a/user/classes/output/user_roles_editable.php +++ b/user/classes/output/user_roles_editable.php @@ -173,8 +173,8 @@ class user_roles_editable extends \core\output\inplace_editable { } // Check that all the groups belong to the course. - $allroles = role_fix_names(get_all_roles($context), $context); - $assignableroles = get_assignable_roles($context, ROLENAME_ALIAS, false); + $allroles = role_fix_names(get_all_roles($context), $context, ROLENAME_BOTH); + $assignableroles = get_assignable_roles($context, ROLENAME_BOTH, false); $viewableroles = get_viewable_roles($context); $userrolesbyid = get_user_roles($context, $userid, true, 'c.contextlevel DESC, r.sortorder ASC'); $profileroles = get_profile_roles($context); diff --git a/user/classes/table/participants.php b/user/classes/table/participants.php index 04d47f56fb7..f03abed8d54 100644 --- a/user/classes/table/participants.php +++ b/user/classes/table/participants.php @@ -202,8 +202,11 @@ class participants extends \table_sql implements dynamic_table { if ($canseegroups) { $this->groups = groups_get_all_groups($this->courseid, 0, 0, 'g.*', true); } - $this->allroles = role_fix_names(get_all_roles($this->context), $this->context); - $this->assignableroles = get_assignable_roles($this->context, ROLENAME_ALIAS, false); + + // If user has capability to review enrol, show them both role names. + $allrolesnamedisplay = ($canreviewenrol ? ROLENAME_BOTH : ROLENAME_ALIAS); + $this->allroles = role_fix_names(get_all_roles($this->context), $this->context, $allrolesnamedisplay); + $this->assignableroles = get_assignable_roles($this->context, ROLENAME_BOTH, false); $this->profileroles = get_profile_roles($this->context); $this->viewableroles = get_viewable_roles($this->context); -- 2.43.0