mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-37026 - lib: The function user_can_assign() returns true for admins.
This commit is contained in:
parent
99584654ce
commit
c154ce5a7f
1 changed files with 7 additions and 2 deletions
|
@ -2937,8 +2937,13 @@ function get_user_roles_in_course($userid, $courseid) {
|
||||||
function user_can_assign(context $context, $targetroleid) {
|
function user_can_assign(context $context, $targetroleid) {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
// first check if user has override capability
|
// First check to see if the user is a site administrator.
|
||||||
// if not return false;
|
if (is_siteadmin()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if user has override capability.
|
||||||
|
// If not return false.
|
||||||
if (!has_capability('moodle/role:assign', $context)) {
|
if (!has_capability('moodle/role:assign', $context)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue