]> git.mjollnir.org Git - moodle.git/commitdiff
accesslib:require_capability() revamp to check for USER->access
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:14:59 +0000 (07:14 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:14:59 +0000 (07:14 +0000)
$USER->capabilities is deprecated.

lib/accesslib.php

index aae7e8fd9a27fa61c3421fb52af19ddb46623e54..66b5ba5a3e94af09bca4ed2f9dff0b7ea07e9929 100755 (executable)
@@ -661,7 +661,7 @@ function require_capability($capability, $context=NULL, $userid=NULL, $doanythin
 
 /// If the current user is not logged in, then make sure they are (if needed)
 
-    if (empty($userid) and empty($USER->capabilities)) {
+    if (is_null($userid) && !isset($USER->access)) {
         if ($context && ($context->contextlevel == CONTEXT_COURSE)) {
             require_login($context->instanceid);
         } else if ($context && ($context->contextlevel == CONTEXT_MODULE)) {