mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Merge branch 'MDL-60960-master' of git://github.com/ryanwyllie/moodle
This commit is contained in:
commit
2692af9032
1 changed files with 9 additions and 4 deletions
|
@ -151,11 +151,16 @@ class container {
|
|||
// 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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue