MDL-61005 core_cohort: Allow teachers to view site-wide cohorts

This commit is contained in:
Dan Marsden
2018-02-22 08:31:59 +08:00
committed by Andrew Nicols
parent bf085b7fc5
commit 457fcfe3d0
+3
View File
@@ -471,6 +471,9 @@ function cohort_get_invisible_contexts() {
$excludedcontexts = array();
foreach ($records as $ctx) {
context_helper::preload_from_record($ctx);
if (context::instance_by_id($ctx->id) == context_system::instance()) {
continue; // System context cohorts should be available and permissions already checked.
}
if (!has_any_capability(array('moodle/cohort:manage', 'moodle/cohort:view'), context::instance_by_id($ctx->id))) {
$excludedcontexts[] = $ctx->id;
}