Permalink
Browse files

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

  • Loading branch information...
1 parent 9958465 commit c154ce5a7f5c58b7dfe984563093a45e1ff29d9f @abgreeve abgreeve committed Dec 6, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/accesslib.php
View
@@ -2937,8 +2937,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 c154ce5

Please sign in to comment.