From 457fcfe3d070b2b65829688b5dd0db2673a31f30 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Mon, 11 Dec 2017 15:33:15 +1300 Subject: [PATCH] MDL-61005 core_cohort: Allow teachers to view site-wide cohorts --- cohort/lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cohort/lib.php b/cohort/lib.php index 467c592121d..76085c67493 100644 --- a/cohort/lib.php +++ b/cohort/lib.php @@ -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; }