MDL-56285 competency: fix move competencies capabilities
In learning plan templates, cannot move competencies around even if capability templatemanage is given to the role because of bad context check
This commit is contained in:
@@ -2196,10 +2196,13 @@ class api {
|
||||
*/
|
||||
public static function reorder_template_competency($templateid, $competencyidfrom, $competencyidto) {
|
||||
static::require_enabled();
|
||||
// First we do a permissions check.
|
||||
$context = context_system::instance();
|
||||
$template = new template($templateid);
|
||||
|
||||
require_capability('moodle/competency:templatemanage', $context);
|
||||
// First we do a permissions check.
|
||||
if (!$template->can_manage()) {
|
||||
throw new required_capability_exception($template->get_context(), 'moodle/competency:templatemanage',
|
||||
'nopermissions', '');
|
||||
}
|
||||
|
||||
$down = true;
|
||||
$matches = template_competency::get_records(array('templateid' => $templateid, 'competencyid' => $competencyidfrom));
|
||||
|
||||
Reference in New Issue
Block a user