r32371 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32370‎ | r32371 | r32372 >
Date:13:47, 24 March 2008
Author:simetrical
Status:old
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/Namespace.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -1770,16 +1770,9 @@
17711771 * @return boolean True: action is allowed, False: action should not be allowed
17721772 */
17731773 function isAllowed($action='') {
1774 - global $wgGroupPermissions;
1775 - if( $action === '' ) {
 1774+ if ( $action === '' )
17761775 // In the spirit of DWIM
17771776 return true;
1778 - }
1779 - if( !empty( $wgGroupPermissions['*'][$action] ) ) {
1780 - # Permissions are additive, so there's no need to unstub the User
1781 - # object in this case.
1782 - return true;
1783 - }
17841777
17851778 return in_array( $action, $this->getRights() );
17861779 }
Index: trunk/phase3/includes/Title.php
@@ -1387,7 +1387,7 @@
13881388 * @todo fold these checks into userCan()
13891389 */
13901390 public function userCanRead() {
1391 - global $wgUser;
 1391+ global $wgUser, $wgGroupPermissions;
13921392
13931393 $result = null;
13941394 wfRunHooks( 'userCan', array( &$this, &$wgUser, 'read', &$result ) );
@@ -1395,6 +1395,10 @@
13961396 return $result;
13971397 }
13981398
 1399+ # Shortcut for public wikis, allows skipping quite a bit of code
 1400+ if ($wgGroupPermissions['*']['read'])
 1401+ return true;
 1402+
13991403 if( $wgUser->isAllowed( 'read' ) ) {
14001404 return true;
14011405 } else {
Index: trunk/phase3/includes/Namespace.php
@@ -165,4 +165,4 @@
166166 return $index >= NS_MAIN;
167167 }
168168
169 -}
 169+}
\ No newline at end of file

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r32370Moving some optimization code into User::isAllowed instead of higher up in Ti...simetrical13:40, 24 March 2008

Status & tagging log