Skip to content

Commit

Permalink
MDL-45874 Fix access to users reports in navigation when using separa…
Browse files Browse the repository at this point in the history
…te groups
  • Loading branch information
danielneis committed Aug 15, 2014
1 parent e1eb180 commit e0530c2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/navigationlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -4132,8 +4132,16 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr
}
$canaccessallgroups = has_capability('moodle/site:accessallgroups', $coursecontext);
if (!$canaccessallgroups && groups_get_course_groupmode($course) == SEPARATEGROUPS) {
// If groups are in use, make sure we can see that group
return false;
// If groups are in use, make sure we can see that group (MDL-45874).
if ($courseid == $this->page->course->id) {
$mygroups = get_fast_modinfo($this->page->course)->groups;
} else {
$mygroups = groups_get_user_groups($courseid);
}
$usergroups = groups_get_user_groups($courseid, $userid);
if (!array_intersect_key($mygroups[0], $usergroups[0])) {
return false;
}
}
}
}
Expand Down

0 comments on commit e0530c2

Please sign in to comment.