]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14679 fixed warning and change false to array() when no users found
authorskodak <skodak>
Sat, 24 May 2008 20:43:33 +0000 (20:43 +0000)
committerskodak <skodak>
Sat, 24 May 2008 20:43:33 +0000 (20:43 +0000)
lib/accesslib.php

index b145508e5f48fa1315981887e411c08c6da6e3bd..87c56ff2f4d3bd73a9d6fd7a543cda5278677870 100755 (executable)
@@ -4202,7 +4202,7 @@ function get_users_by_capability($context, $capability, $fields='', $sort='',
     $roleids = array_unique($roleids);
 
     if (count($roleids)===0) { // noone here!
-        return false;
+        return array();
     }
 
     // is the default role interesting? does it have
@@ -4641,9 +4641,9 @@ function has_capability_from_rarc($ras, $roleperms, $capability, $doanything) {
             $hascap[$cap]->perm += $rp->perm;
         }
     }
-    if ($hascap[$capability]->perm > 0
-        || ($doanything && isset($hascap['moodle/site:candoanything'])
-            && $hascap['moodle/site:candoanything']->perm > 0)) {
+    if ((isset($hascap[$capability]->perm) and  $hascap[$capability]->perm > 0)
+        or ($doanything and isset($hascap['moodle/site:candoanything'])
+            and $hascap['moodle/site:candoanything']->perm > 0)) {
         return true;
     }
     return false;