Actually, revert r32370. It might be a good idea, but it breaks the UserGetRights...
authorAryeh Gregor <simetrical@users.mediawiki.org>
Mon, 24 Mar 2008 13:47:16 +0000 (13:47 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Mon, 24 Mar 2008 13:47:16 +0000 (13:47 +0000)
includes/Namespace.php
includes/Title.php
includes/User.php

index 71e3654..b31b240 100644 (file)
@@ -165,4 +165,4 @@ class MWNamespace {
                return $index >= NS_MAIN;
        }
         
-}
+}
\ No newline at end of file
index d91036a..0c91eab 100644 (file)
@@ -1387,7 +1387,7 @@ class Title {
         * @todo fold these checks into userCan()
         */
        public function userCanRead() {
-               global $wgUser;
+               global $wgUser, $wgGroupPermissions;
 
                $result = null;
                wfRunHooks( 'userCan', array( &$this, &$wgUser, 'read', &$result ) );
@@ -1395,6 +1395,10 @@ class Title {
                        return $result;
                }
 
+               # Shortcut for public wikis, allows skipping quite a bit of code
+               if ($wgGroupPermissions['*']['read'])
+                       return true;
+
                if( $wgUser->isAllowed( 'read' ) ) {
                        return true;
                } else {
index f4edaf2..a8bfbe6 100644 (file)
@@ -1770,16 +1770,9 @@ class User {
         * @return boolean True: action is allowed, False: action should not be allowed
         */
        function isAllowed($action='') {
-               global $wgGroupPermissions;
-               if( $action === '' ) {
+               if ( $action === '' )
                        // In the spirit of DWIM
                        return true;
-               }
-               if( !empty( $wgGroupPermissions['*'][$action] ) ) {
-                       # Permissions are additive, so there's no need to unstub the User
-                       # object in this case.
-                       return true;
-               }
 
                return in_array( $action, $this->getRights() );
        }