MDL-70261 course: Allow update locked course custom fields

on course upload.
This commit is contained in:
Ilya Tregubov
2020-12-15 14:39:56 +02:00
parent d328ef1c9d
commit ef27ea9f90
@@ -102,8 +102,13 @@ class course_handler extends \core_customfield\handler {
has_capability('moodle/course:changelockedcustomfields', $context));
} else {
$context = $this->get_parent_context();
return (!$field->get_configdata_property('locked') ||
guess_if_creator_will_have_course_capability('moodle/course:changelockedcustomfields', $context));
if ($context->contextlevel == CONTEXT_SYSTEM) {
return (!$field->get_configdata_property('locked') ||
has_capability('moodle/course:changelockedcustomfields', $context));
} else {
return (!$field->get_configdata_property('locked') ||
guess_if_creator_will_have_course_capability('moodle/course:changelockedcustomfields', $context));
}
}
}