Skip to content
Browse files

MDL-37026 - lib: The function user_can_assign() returns true for admins.

  • Loading branch information...
1 parent 0395306 commit 3370f216a2f54852cf0f52f393e6c5117b844210 @abgreeve abgreeve committed Dec 6, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/accesslib.php
View
9 lib/accesslib.php
@@ -2956,8 +2956,13 @@ function get_user_roles_in_course($userid, $courseid) {
function user_can_assign(context $context, $targetroleid) {
global $DB;
- // first check if user has override capability
- // if not return false;
+ // First check to see if the user is a site administrator.
+ if (is_siteadmin()) {
+ return true;
+ }
+
+ // Check if user has override capability.
+ // If not return false.
if (!has_capability('moodle/role:assign', $context)) {
return false;
}

0 comments on commit 3370f21

Please sign in to comment.
Something went wrong with that request. Please try again.