mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-69093 enrol_manual: added check for allowed roles a user can assign
This commit is contained in:
parent
877a3f70d0
commit
d07fb8b9e8
1 changed files with 7 additions and 0 deletions
|
@ -100,6 +100,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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue