Skip to content

Commit

Permalink
Merge branch 'MDL-60045_master-v2' of git://github.com/markn86/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Sep 19, 2017
2 parents c8d20b2 + fe21429 commit 363d815
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion user/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
$courseid = optional_param('id', 0, PARAM_INT); // This are required.
$newcourse = optional_param('newcourse', false, PARAM_BOOL);
$selectall = optional_param('selectall', false, PARAM_BOOL); // When rendering checkboxes against users mark them all checked.
$roleid = optional_param('roleid', 0, PARAM_INT);

$PAGE->set_url('/user/index.php', array(
'page' => $page,
Expand Down Expand Up @@ -105,6 +106,18 @@
$filtersapplied = optional_param_array('unified-filters', [], PARAM_TEXT);
$filterwassubmitted = optional_param('unified-filter-submitted', 0, PARAM_BOOL);

// If they passed a role make sure they can view that role.
if ($roleid) {
$viewableroles = get_profile_roles($context);

// Check if the user can view this role.
if (array_key_exists($roleid, $viewableroles)) {
$filtersapplied[] = USER_FILTER_ROLE . ':' . $roleid;
} else {
$roleid = 0;
}
}

// Default group ID.
$groupid = false;
$canaccessallgroups = has_capability('moodle/site:accessallgroups', $context);
Expand All @@ -126,7 +139,6 @@
$hasgroupfilter = false;
$lastaccess = 0;
$searchkeywords = [];
$roleid = 0;
$enrolid = 0;
$status = -1;
foreach ($filtersapplied as $filter) {
Expand Down

0 comments on commit 363d815

Please sign in to comment.