MDL-57001 roles: Do access check for switchroles

Put it in the API so it can't be skipped.
This commit is contained in:
Damyon Wiese 2016-11-24 15:01:55 +08:00
parent 7dba450fd4
commit 2fedc0da7c

View File

@ -3169,6 +3169,11 @@ function get_assignable_roles(context $context, $rolenamedisplay = ROLENAME_ALIA
function get_switchable_roles(context $context) {
global $USER, $DB;
// You can't switch roles without this capability.
if (!has_capability('moodle/role:switchroles', $context)) {
return [];
}
$params = array();
$extrajoins = '';
$extrawhere = '';