]> git.mjollnir.org Git - moodle.git/commitdiff
fix has_capability() to work when $nomoodlecookie = true; MDL-7156 - needed for RSS...
authorskodak <skodak>
Sat, 21 Oct 2006 20:42:50 +0000 (20:42 +0000)
committerskodak <skodak>
Sat, 21 Oct 2006 20:42:50 +0000 (20:42 +0000)
lib/accesslib.php

index aa8735492d91c7f29998e4a448928d91a586084d..b35ec3b0c26451c45e115594a94d677e5edc6ffd 100755 (executable)
@@ -284,7 +284,7 @@ function has_capability($capability, $context=NULL, $userid=NULL, $doanything=tr
         }
     }
 
-    if ($userid && $userid != $USER->id) {
+    if ($userid && (($USER === NULL) or ($userid != $USER->id))) {
         if (empty($USER->id) or ($userid != $USER->id)) {
             $capabilities = load_user_capability($capability, $context, $userid);
         } else { //$USER->id == $userid