From b9a8ffba8b3610db0762a9c6b002bb5b680cba90 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Mon, 24 Mar 2008 13:47:16 +0000 Subject: [PATCH] Actually, revert r32370. It might be a good idea, but it breaks the UserGetRights hook (more than it already is). Could use some more thought. --- includes/Namespace.php | 2 +- includes/Title.php | 6 +++++- includes/User.php | 9 +-------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/includes/Namespace.php b/includes/Namespace.php index 71e3654520..b31b2404a1 100644 --- a/includes/Namespace.php +++ b/includes/Namespace.php @@ -165,4 +165,4 @@ class MWNamespace { return $index >= NS_MAIN; } -} +} \ No newline at end of file diff --git a/includes/Title.php b/includes/Title.php index d91036ab99..0c91eab141 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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 { diff --git a/includes/User.php b/includes/User.php index f4edaf2675..a8bfbe65d3 100644 --- a/includes/User.php +++ b/includes/User.php @@ -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() ); } -- 2.20.1