MDL-14679 fixed warning and change false to array() when no users found

This commit is contained in:
skodak
2008-05-24 20:43:33 +00:00
parent 3b90506304
commit dc10f119bb
+4 -4
View File
@@ -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;