From 95a76b29a8a948f6db8568f232a6ba846961b5a7 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. --- cohort/classes/reportbuilder/local/systemreports/cohorts.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cohort/classes/reportbuilder/local/systemreports/cohorts.php b/cohort/classes/reportbuilder/local/systemreports/cohorts.php index 668c1203022..62d8388e462 100644 --- a/cohort/classes/reportbuilder/local/systemreports/cohorts.php +++ b/cohort/classes/reportbuilder/local/systemreports/cohorts.php @@ -62,7 +62,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; }