Dan-nl has submitted this change and it was merged.
Change subject: correcting gwtoolset permission check
......................................................................
correcting gwtoolset permission check
Bug: 58602
Bug: 58598
Bug: 58636
Change-Id: Ibd1ab2c9fe4f72d4b9ca7f1515a49bd73a15babe
---
M GWToolset.i18n.php
M includes/Config.php
M includes/Helpers/WikiChecks.php
3 files changed, 5 insertions(+), 42 deletions(-)
Approvals:
Dan-nl: Verified; Looks good to me, approved
diff --git a/GWToolset.i18n.php b/GWToolset.i18n.php
index 1a33def..05a480c 100644
--- a/GWToolset.i18n.php
+++ b/GWToolset.i18n.php
@@ -269,7 +269,6 @@
These are set lower than the wiki\'s <code>$wgMaxUploadSize</code>, which is
set at "$3". Please adjust the <code>php.ini</code> settings as appropriate.',
'gwtoolset-mediawiki-version-invalid' => 'This extension requires
MediaWiki version $1<br />This MediaWiki version is $2.',
- 'gwtoolset-no-upload-by-url' => 'You are not part of a group that has
the right to upload by URL.',
'gwtoolset-permission-not-given' => 'Make sure that you are logged in
or contact an administrator in order to be granted permission to view this page
($1).',
'gwtoolset-user-blocked' => 'Your user account is currently blocked.
Please contact an administrator in order to correct the blocking issue.',
'gwtoolset-required-group' => 'You are not a member of the, $1, group.',
diff --git a/includes/Config.php b/includes/Config.php
index 7b7d47a..dd719c9 100644
--- a/includes/Config.php
+++ b/includes/Config.php
@@ -206,7 +206,7 @@
* @var {string}
* user right required, e.g. "block" or "delete"
*/
- public static $special_page_restriction = 'upload_by_url';
+ public static $special_page_restriction = 'gwtoolset';
/**
* @see SpecialPage __constructor
@@ -235,21 +235,15 @@
public static $use_file_accept_attribute = true;
/**
- * @var {string}
- * the user group the user must be a member of in order to be able to
use this extension
- * @see GWToolset\Helpers\WikiChecks\checkUserWikiGroups
- */
- public static $user_group = 'gwtoolset';
-
- /**
* @var {array}
* user permissions required in order to be able to use this extension
* @see GWToolset\Helpers\WikiChecks\checkUserPermissions
*/
public static $user_permissions = array(
+ 'edit',
+ 'gwtoolset',
'upload',
- 'upload_by_url',
- 'edit'
+ 'upload_by_url'
);
}
diff --git a/includes/Helpers/WikiChecks.php b/includes/Helpers/WikiChecks.php
index 3cb4141..c7a9e25 100644
--- a/includes/Helpers/WikiChecks.php
+++ b/includes/Helpers/WikiChecks.php
@@ -12,7 +12,6 @@
GWToolset\Constants,
GWToolset\Utils,
MWException,
- PermissionsError,
SpecialPage,
Status;
@@ -40,14 +39,7 @@
* @return {Status}
*/
public static function canUserViewPage( SpecialPage $SpecialPage ) {
- try {
- $SpecialPage->checkPermissions();
- } catch ( PermissionsError $e ) {
- return Status::newFatal(
- 'gwtoolset-permission-not-given',
- wfMessage( 'gwtoolset-no-upload-by-url'
)->escaped()
- );
- }
+ $SpecialPage->checkPermissions();
return Status::newGood();
}
@@ -139,23 +131,6 @@
|| version_compare( PHP_VERSION, '5.3.3', '<' )
) {
return Status::newFatal(
'gwtoolset-verify-php-version', Constants::EXTENSION_NAME );
- }
-
- return Status::newGood();
- }
-
- /**
- * Make sure the user is a member of a group that can access this
extension
- *
- * @param {SpecialPage} $SpecialPage
- * @return {Status}
- */
- public static function checkUserWikiGroups( SpecialPage $SpecialPage ) {
- if ( !in_array( Config::$user_group,
$SpecialPage->getUser()->getEffectiveGroups() ) ) {
- return Status::newFatal(
- 'gwtoolset-permission-not-given',
- wfMessage( 'gwtoolset-required-group'
)->params( Config::$user_group )->escaped()
- );
}
return Status::newGood();
@@ -292,11 +267,6 @@
}
$Status = self::canUserViewPage( $SpecialPage );
- if ( !$Status->ok ) {
- return $Status;
- }
-
- $Status = self::checkUserWikiGroups( $SpecialPage );
if ( !$Status->ok ) {
return $Status;
}
--
To view, visit https://gerrit.wikimedia.org/r/102814
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibd1ab2c9fe4f72d4b9ca7f1515a49bd73a15babe
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/GWToolset
Gerrit-Branch: master
Gerrit-Owner: Dan-nl <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: Dan-nl <[email protected]>
Gerrit-Reviewer: Gergő Tisza <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits