From ac5751ee48820f72f31ca153c887faba00ee33ba Mon Sep 17 00:00:00 2001 From: Happy-melon Date: Fri, 18 Mar 2011 21:07:05 +0000 Subject: [PATCH] Follow-up r84249: reimplement isAllowedAny(), and restore isAllowed() to only-accepting-one-parameter mode for the time being. --- includes/Article.php | 2 +- includes/HistoryPage.php | 2 +- includes/ImagePage.php | 4 ++-- includes/ProtectionForm.php | 4 ++-- includes/User.php | 4 ++-- includes/specials/SpecialImport.php | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index ad75953fd0..9b99327a40 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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; } diff --git a/includes/HistoryPage.php b/includes/HistoryPage.php index d5991aa50a..8c584f9483 100644 --- a/includes/HistoryPage.php +++ b/includes/HistoryPage.php @@ -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 diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 183e933ebd..0bbf58b797 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -930,7 +930,7 @@ class ImageHistoryList { . $navLinks . "\n" . Xml::openElement( 'table', array( 'class' => 'wikitable filehistory' ) ) . "\n" . '' - . ( $this->current->isLocal() && ( $wgUser->isAllowed( 'delete', 'deletedhistory' ) ) ? '' : '' ) + . ( $this->current->isLocal() && ( $wgUser->isAllowedAny( 'delete', 'deletedhistory' ) ) ? '' : '' ) . '' . wfMsgHtml( 'filehist-datetime' ) . '' . ( $this->showThumb ? '' . wfMsgHtml( 'filehist-thumb' ) . '' : '' ) . '' . wfMsgHtml( 'filehist-dimensions' ) . '' @@ -961,7 +961,7 @@ class ImageHistoryList { $row = $selected = ''; // Deletion link - if ( $local && ( $wgUser->isAllowed( 'delete', 'deletedhistory' ) ) ) { + if ( $local && ( $wgUser->isAllowedAny( 'delete', 'deletedhistory' ) ) ) { $row .= ''; # Link to remove from history if ( $wgUser->isAllowed( 'delete' ) ) { diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 5f9d5d88d9..31c5019181 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -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 ) diff --git a/includes/User.php b/includes/User.php index 4fb0d1ec3a..a0fce2c426 100644 --- a/includes/User.php +++ b/includes/User.php @@ -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 } diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index 336576cc90..7bb7950ef7 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -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' ) ); -- 2.20.1