Permalink
Browse files

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

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

Please sign in to comment.