diff --git a/htdocs/artefact/file/blocktype/gallery/lib.php b/htdocs/artefact/file/blocktype/gallery/lib.php index 714a783b8c4c85f4592404794a2f848dcecd8db1..28ca09cec62fa75d76605cdb8936fc3a01d05f25 100644 --- a/htdocs/artefact/file/blocktype/gallery/lib.php +++ b/htdocs/artefact/file/blocktype/gallery/lib.php @@ -592,6 +592,15 @@ class PluginBlocktypeGallery extends PluginBlocktype { } } } + + if (!empty($values['folder'])) { + $folder = artefact_instance_from_id($values['folder']); + if (!($folder instanceof ArtefactTypeFolder) || !$USER->can_publish_artefact($folder)) { + $result['message'] = get_string('unrecoverableerror', 'error'); + $form->set_error(null, $result['message']); + $form->reply(PIEFORM_ERR, $result); + } + } } public static function instance_config_save($values) {