From 119db785b12abaec9d1e8458136d57bca9ccade5 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Fri, 2 May 2025 11:12:16 +0100 Subject: [PATCH] MDL-85348 cohort: disable report bulk deletion for managed cohorts. --- .../classes/reportbuilder/local/systemreports/cohorts.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/cohort/classes/reportbuilder/local/systemreports/cohorts.php b/public/cohort/classes/reportbuilder/local/systemreports/cohorts.php index 1c543a6a51f..be41c81f9f3 100644 --- a/public/cohort/classes/reportbuilder/local/systemreports/cohorts.php +++ b/public/cohort/classes/reportbuilder/local/systemreports/cohorts.php @@ -63,7 +63,8 @@ class cohorts extends system_report { "{$entitymainalias}.component, {$entitymainalias}.name"); $this->set_checkbox_toggleall(static function(stdClass $cohort): ?array { - if (!has_capability('moodle/cohort:manage', context::instance_by_id($cohort->contextid))) { + if (!empty($cohort->component) || + !has_capability('moodle/cohort:manage', context::instance_by_id($cohort->contextid))) { return null; }