Permalink
Browse files

MDL-34530 Calendar: Can create event for any group, but cannot view it

  • Loading branch information...
1 parent 7e8ae12 commit 462e42cb9a9ee8352755654e6f03c2cf0b0711a2 @jason-platts jason-platts committed Oct 23, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 calendar/lib.php
View
@@ -1724,11 +1724,19 @@ function calendar_get_allowed_types(&$allowed, $course = null) {
$allowed->courses = array($course->id => 1);
if ($course->groupmode != NOGROUPS || !$course->groupmodeforce) {
- $allowed->groups = groups_get_all_groups($course->id);
+ if (has_capability('moodle/site:accessallgroups', $coursecontext)) {
+ $allowed->groups = groups_get_all_groups($course->id);
+ } else {
+ $allowed->groups = groups_get_all_groups($course->id, $USER->id);
+ }
}
} else if (has_capability('moodle/calendar:managegroupentries', $coursecontext)) {
if($course->groupmode != NOGROUPS || !$course->groupmodeforce) {
- $allowed->groups = groups_get_all_groups($course->id);
+ if (has_capability('moodle/site:accessallgroups', $coursecontext)) {
+ $allowed->groups = groups_get_all_groups($course->id);
+ } else {
+ $allowed->groups = groups_get_all_groups($course->id, $USER->id);
+ }
}
}
}

0 comments on commit 462e42c

Please sign in to comment.