Skip to content

Commit

Permalink
MDL-70261 course: Allow update locked course custom fields
Browse files Browse the repository at this point in the history
                  on course upload.
  • Loading branch information
ilyatregubov committed Dec 15, 2020
1 parent c307f3b commit 3952391
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions course/classes/customfield/course_handler.php
Expand Up @@ -102,8 +102,13 @@ public function can_edit(field_controller $field, int $instanceid = 0) : bool {
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));
}
}
}

Expand Down

0 comments on commit 3952391

Please sign in to comment.