Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge branch 'MDL-60960-master' of git://github.com/ryanwyllie/moodle
- Loading branch information
Showing
with
9 additions
and
4 deletions.
-
+9
−4
calendar/classes/local/event/container.php
|
@@ -151,11 +151,16 @@ function ($dbrow) { |
|
|
// 2) Only process modules for courses a user has the capability to view OR they are enrolled in. |
|
|
// 3) Only process modules for courses that are visible OR if the course is not visible, the user |
|
|
// has the capability to view hidden courses. |
|
|
if (!$cm->uservisible) { |
|
|
return true; |
|
|
} |
|
|
|
|
|
$coursecontext = \context_course::instance($dbrow->courseid); |
|
|
$canseecourse = has_capability('moodle/course:view', $coursecontext) || is_enrolled($coursecontext); |
|
|
$canseecourse = $canseecourse && |
|
|
($cm->get_course()->visible || has_capability('moodle/course:viewhiddencourses', $coursecontext)); |
|
|
if (!$cm->uservisible || !$canseecourse) { |
|
|
if (!$cm->get_course()->visible && !has_capability('moodle/course:viewhiddencourses', $coursecontext)) { |
|
|
return true; |
|
|
} |
|
|
|
|
|
if (!has_capability('moodle/course:view', $coursecontext) && !is_enrolled($coursecontext)) { |
|
|
return true; |
|
|
} |
|
|
|
|
|