MDL-64984 mod_glossary: capability check when restoring global type.

This commit is contained in:
Paul Holden 2024-06-17 21:53:25 +01:00 committed by Jenkins
parent 51af50ade5
commit 80782f8907

View File

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