Commit 19fa0921 authored by victor's avatar victor 🙇 Committed by Jenkins
Browse files

MDL-69093 enrol_manual: added check for allowed roles a user can assign

parent cb51c8ae
......@@ -97,6 +97,13 @@ switch ($action) {
if (empty($roleid)) {
$roleid = null;
} else {
if (!has_capability('moodle/role:assign', $context)) {
throw new enrol_ajax_exception('assignnotpermitted');
}
if (!array_key_exists($roleid, get_assignable_roles($context, ROLENAME_ALIAS, false))) {
throw new enrol_ajax_exception('invalidrole');
}
}
if (empty($startdate)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment