From 8304649791c79f2a07cdb4881dea0e40a6706de8 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Thu, 4 Jul 2024 19:22:02 +0100 Subject: [PATCH] MDL-82390 badges: correct context check when deleting badges. --- badges/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/badges/index.php b/badges/index.php index df043ec35e8..ced1b04e844 100644 --- a/badges/index.php +++ b/badges/index.php @@ -91,9 +91,10 @@ if (!has_any_capability(array( $PAGE->set_title($hdr); $output = $PAGE->get_renderer('core', 'badges'); -if (($delete || $archive) && has_capability('moodle/badges:deletebadge', $PAGE->context)) { +if ($delete || $archive) { $badgeid = ($archive != 0) ? $archive : $delete; $badge = new badge($badgeid); + require_capability('moodle/badges:deletebadge', $badge->get_context()); if (!$confirm) { echo $output->header(); // Archive this badge?