Follow-up r84249: reimplement isAllowedAny(), and restore isAllowed() to only-accepti...
authorHappy-melon <happy-melon@users.mediawiki.org>
Fri, 18 Mar 2011 21:07:05 +0000 (21:07 +0000)
committerHappy-melon <happy-melon@users.mediawiki.org>
Fri, 18 Mar 2011 21:07:05 +0000 (21:07 +0000)
includes/Article.php
includes/HistoryPage.php
includes/ImagePage.php
includes/ProtectionForm.php
includes/User.php
includes/specials/SpecialImport.php

index ad75953..9b99327 100644 (file)
@@ -3458,7 +3458,7 @@ class Article {
                        $flags |= EDIT_MINOR;
                }
 
-               if ( $bot && ( $wgUser->isAllowed( 'markbotedits', 'bot' ) ) ) {
+               if ( $bot && ( $wgUser->isAllowedAny( 'markbotedits', 'bot' ) ) ) {
                        $flags |= EDIT_FORCE_BOT;
                }
 
index d5991aa..8c584f9 100644 (file)
@@ -510,7 +510,7 @@ class HistoryPager extends ReverseChronologicalPager {
 
                $del = '';
                // Show checkboxes for each revision
-               if ( $wgUser->isAllowed( 'deleterevision', 'revisionmove' ) ) {
+               if ( $wgUser->isAllowedAny( 'deleterevision', 'revisionmove' ) ) {
                        $this->preventClickjacking();
                        // If revision was hidden from sysops, disable the checkbox
                        // However, if the user has revisionmove rights, we cannot disable the checkbox
index 183e933..0bbf58b 100644 (file)
@@ -930,7 +930,7 @@ class ImageHistoryList {
                        . $navLinks . "\n"
                        . Xml::openElement( 'table', array( 'class' => 'wikitable filehistory' ) ) . "\n"
                        . '<tr><td></td>'
-                       . ( $this->current->isLocal() && ( $wgUser->isAllowed( 'delete', 'deletedhistory' ) ) ? '<td></td>' : '' )
+                       . ( $this->current->isLocal() && ( $wgUser->isAllowedAny( 'delete', 'deletedhistory' ) ) ? '<td></td>' : '' )
                        . '<th>' . wfMsgHtml( 'filehist-datetime' ) . '</th>'
                        . ( $this->showThumb ? '<th>' . wfMsgHtml( 'filehist-thumb' ) . '</th>' : '' )
                        . '<th>' . wfMsgHtml( 'filehist-dimensions' ) . '</th>'
@@ -961,7 +961,7 @@ class ImageHistoryList {
                $row = $selected = '';
 
                // Deletion link
-               if ( $local && ( $wgUser->isAllowed( 'delete', 'deletedhistory' ) ) ) {
+               if ( $local && ( $wgUser->isAllowedAny( 'delete', 'deletedhistory' ) ) ) {
                        $row .= '<td>';
                        # Link to remove from history
                        if ( $wgUser->isAllowed( 'delete' ) ) {
index 5f9d5d8..31c5019 100644 (file)
@@ -133,7 +133,7 @@ class ProtectionForm {
                                // Prevent users from setting levels that they cannot later unset
                                if( $val == 'sysop' ) {
                                        // Special case, rewrite sysop to either protect and editprotected
-                                       if( !$wgUser->isAllowed( 'protect', 'editprotected' ) )
+                                       if( !$wgUser->isAllowedAny( 'protect', 'editprotected' ) )
                                                continue;
                                } else {
                                        if( !$wgUser->isAllowed($val) )
@@ -527,7 +527,7 @@ class ProtectionForm {
                        //don't let them choose levels above their own (aka so they can still unprotect and edit the page). but only when the form isn't disabled
                        if( $key == 'sysop' ) {
                                //special case, rewrite sysop to protect and editprotected
-                               if( !$wgUser->isAllowed( 'protect', 'editprotected' ) && !$this->disabled )
+                               if( !$wgUser->isAllowedAny( 'protect', 'editprotected' ) && !$this->disabled )
                                        continue;
                        } else {
                                if( !$wgUser->isAllowed($key) && !$this->disabled )
index 4fb0d1e..a0fce2c 100644 (file)
@@ -2248,7 +2248,7 @@ class User {
         * @param varargs String permissions to test
         * @return Boolean: True if user is allowed to perform *any* of the given actions
         */
-       public function isAllowed( /*...*/ ){
+       public function isAllowedAny( /*...*/ ){
                $permissions = func_get_args();
                foreach( $permissions as $permission ){
                        if( $this->isAllowedInternal( $permission ) ){
@@ -2277,7 +2277,7 @@ class User {
         * @param $action String
         * @return bool
         */
-       private function isAllowedInternal( $action = '' ) {
+       public function isAllowed( $action = '' ) {
                if ( $action === '' ) {
                        return true; // In the spirit of DWIM
                }
index 336576c..7bb7950 100644 (file)
@@ -144,7 +144,7 @@ class SpecialImport extends SpecialPage {
 
        private function showForm() {
                global $wgUser, $wgOut, $wgImportSources, $wgExportMaxLinkDepth;
-               if( !$wgUser->isAllowed( 'import', 'importupload' ) )
+               if( !$wgUser->isAllowedAny( 'import', 'importupload' ) )
                        return $wgOut->permissionRequired( 'import' );
 
                $action = $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) );