From 80782f8907854e407a044c322638a749e76d2d74 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Mon, 17 Jun 2024 21:53:25 +0100 Subject: [PATCH] MDL-64984 mod_glossary: capability check when restoring global type. --- mod/glossary/backup/moodle2/restore_glossary_stepslib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mod/glossary/backup/moodle2/restore_glossary_stepslib.php b/mod/glossary/backup/moodle2/restore_glossary_stepslib.php index b4f750d0a9b..dcd04739e28 100644 --- a/mod/glossary/backup/moodle2/restore_glossary_stepslib.php +++ b/mod/glossary/backup/moodle2/restore_glossary_stepslib.php @@ -69,6 +69,9 @@ class restore_glossary_activity_structure_step extends restore_activity_structur if (!in_array($data->displayformat, $formats)) { $data->displayformat = 'dictionary'; } + if (!empty($data->globalglossary) && !has_capability('mod/glossary:manageentries', context_system::instance())) { + $data->globalglossary = 0; + } if (!empty($data->mainglossary) and $data->mainglossary == 1 and $DB->record_exists('glossary', array('mainglossary' => 1, 'course' => $this->get_courseid()))) { // Only allow one main glossary in the course