Mailing List Archive

[MediaWiki-commits] [Gerrit] mediawiki...BlueSpiceUniversalExport[master]: Permission: Replaced permission check for "universalexport-e...
Dvogel hallowelt has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406021 )

Change subject: Permission: Replaced permission check for "universalexport-export" with "read"
......................................................................

Permission: Replaced permission check for "universalexport-export" with "read"

and removed all other permission checks with "universalexport-"

Change-Id: Ib3140f08feeb284ea12d56545aa8d973013ecef8
---
M UniversalExport.class.php
M includes/UniversalExportHelper.class.php
M includes/specials/SpecialUniversalExport.class.php
3 files changed, 6 insertions(+), 30 deletions(-)


git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceUniversalExport refs/changes/21/406021/1

diff --git a/UniversalExport.class.php b/UniversalExport.class.php
index b8422fb..d9d8770 100644
--- a/UniversalExport.class.php
+++ b/UniversalExport.class.php
@@ -81,9 +81,6 @@
BsConfig::registerVar( 'MW::UniversalExport::ParamsDefaults', $this->aParamsDefaults, BsConfig::LEVEL_PRIVATE|BsConfig::TYPE_ARRAY_MIXED );
BsConfig::registerVar( 'MW::UniversalExport::ParamsOverrides', $this->aParamsOverrides, BsConfig::LEVEL_PRIVATE|BsConfig::TYPE_ARRAY_MIXED );

- //Permissions
- $this->mCore->registerPermission( 'universalexport-export', array(), array( 'type' => 'namespace' ) );
-
wfProfileOut( 'BS::'.__METHOD__ );
}

@@ -214,7 +211,7 @@
if( !in_array( $sAction, array( 'view', 'historysubmit' ) ) ) return null;

$oCurrentTitle = $this->getTitle();
- if( $oCurrentTitle->quickUserCan( 'universalexport-export' ) === false ) return null;
+ if( $oCurrentTitle->quickUserCan( 'read' ) === false ) return null;

$aCurrentQueryParams = $this->getRequest()->getValues();
$sTitle = isset($aCurrentQueryParams['title']) ? $aCurrentQueryParams['title'] : "";
diff --git a/includes/UniversalExportHelper.class.php b/includes/UniversalExportHelper.class.php
index 03481a0..9d81898 100644
--- a/includes/UniversalExportHelper.class.php
+++ b/includes/UniversalExportHelper.class.php
@@ -40,33 +40,12 @@
$bErrorOccurred = false;
foreach( $aParams as $sValue ) {
if ( $oTitle->getNamespace() == NS_SPECIAL ) {
- switch( $sValue ) {
- case 'recursive':
- if( !$wgUser->isAllowed( 'universalexport-export-recursive' ) ) $bErrorOccurred = true;
- break;
- case 'with-attachments':
- if( !$wgUser->isAllowed( 'universalexport-export-with-attachments' ) ) $bErrorOccurred = true;
- break;
- case 'unfiltered':
- if( !$wgUser->isAllowed( 'universalexport-export-unfiltered' ) ) $bErrorOccurred = true;
- break;
- }
+ if( !$wgUser->isAllowed( 'read' ) ) $bErrorOccurred = true;
}
else{
- switch( $sValue ) {
- case 'recursive':
- if( !$oTitle->userCan( 'universalexport-export-recursive' ) ) $bErrorOccurred = true;
- break;
- case 'with-attachments':
- if( !$oTitle->userCan( 'universalexport-export-with-attachments' ) ) $bErrorOccurred = true;
- break;
- case 'unfiltered':
- if( !$oTitle->userCan( 'universalexport-export-unfiltered' ) ) $bErrorOccurred = true;
- break;
- }
+ if( !$oTitle->userCan( 'read' ) ) $bErrorOccurred = true;
}
}
-

if( $bErrorOccurred ) throw new Exception ( 'error-no-permission' );
}
diff --git a/includes/specials/SpecialUniversalExport.class.php b/includes/specials/SpecialUniversalExport.class.php
index e1d0f30..ba052f0 100644
--- a/includes/specials/SpecialUniversalExport.class.php
+++ b/includes/specials/SpecialUniversalExport.class.php
@@ -66,7 +66,7 @@
* The default contructor of the SpecialUniversalExport class
*/
function __construct() {
- parent::__construct( 'UniversalExport', 'universalexport-export', true );
+ parent::__construct( 'UniversalExport', 'read', true );

$this->oOutputPage = $this->getOutput();

@@ -132,10 +132,10 @@

//Title::userCan always returns false on special pages (exept for createaccount action)
if( $this->oRequestedTitle->getNamespace() === NS_SPECIAL ) {
- if( $this->getUser()->isAllowed('universalexport-export') !== true ) {
+ if( $this->getUser()->isAllowed( 'read' ) !== true ) {
throw new Exception( 'bs-universalexport-error-permission');
}
- } elseif( $this->oRequestedTitle->userCan( 'universalexport-export' ) === false ) {
+ } elseif( $this->oRequestedTitle->userCan( 'read' ) === false ) {
throw new Exception( 'bs-universalexport-error-permission');
}


--
To view, visit https://gerrit.wikimedia.org/r/406021
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3140f08feeb284ea12d56545aa8d973013ecef8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceUniversalExport
Gerrit-Branch: master
Gerrit-Owner: Dvogel hallowelt <daniel.vogel@hallowelt.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits