MDL-82390 badges: correct context check when deleting badges.

This commit is contained in:
Paul Holden 2024-07-04 19:22:02 +01:00 committed by Jenkins
parent c8c3b17cd2
commit 8304649791

View File

@ -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?