Skip to content

Commit

Permalink
MDL-59801 roles: Allow filter by assignable roles
Browse files Browse the repository at this point in the history
If you can edit roles on the participants page you should be able to filter by any assignable role
  • Loading branch information
Damyon Wiese committed Aug 22, 2017
1 parent 9df2fde commit 555a43a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion user/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,13 @@ public function unified_filter($course, $context, $filtersapplied) {
}

// Filter options for role.
$roles = role_fix_names(get_profile_roles($context), $context, ROLENAME_ALIAS, true);
$roleseditable = has_capability('moodle/role:assign', $context);
$roles = [];
if ($roleseditable) {
$roles = get_assignable_roles($context, ROLENAME_ALIAS);
} else {
$roles = role_fix_names(get_profile_roles($context), $context, ROLENAME_ALIAS, true);
}
$criteria = get_string('role');
$roleoptions = [];
foreach ($roles as $id => $role) {
Expand Down

0 comments on commit 555a43a

Please sign in to comment.