]> git.mjollnir.org Git - moodle.git/commitdiff
fixed warning during initial install when creating admin roles
authorskodak <skodak>
Sun, 10 Sep 2006 20:29:44 +0000 (20:29 +0000)
committerskodak <skodak>
Sun, 10 Sep 2006 20:29:44 +0000 (20:29 +0000)
lib/accesslib.php

index ad307a9dfcb1840f3dafa34411c044248f974733..25a365f7e531a5483a162892f376f006e53b6219 100755 (executable)
@@ -1054,12 +1054,13 @@ function create_role($name, $description, $legacy='') {
         /// should be able to assign users to this new role, and override this new role's capabilities
         
         // find all admin roles
-        $adminroles = get_roles_with_capability('moodle/role:manage', CAP_ALLOW, $context);
-        // foreach admin role
-        foreach ($adminroles as $arole) {
-            // write allow_assign and allow_overrid
-            allow_assign($arole->id, $id);
-            allow_override($arole->id, $id);  
+        if ($adminroles = get_roles_with_capability('moodle/role:manage', CAP_ALLOW, $context)) {
+            // foreach admin role
+            foreach ($adminroles as $arole) {
+                // write allow_assign and allow_overrid
+                allow_assign($arole->id, $id);
+                allow_override($arole->id, $id);  
+            }
         }
         
         return $id;