r101810 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101809‎ | r101810 | r101811 >
Date:14:32, 3 November 2011
Author:hashar
Status:ok (Comments)
Tags:
Comment:
SpecialPage permission is now vipsscaler-test

By default, everyone is allowed to use Special:VipsTest
Modified paths:
  • /trunk/extensions/VipsScaler/SpecialVipsTest.php (modified) (history)
  • /trunk/extensions/VipsScaler/VipsScaler.php (modified) (history)

Diff [purge]

Index: trunk/extensions/VipsScaler/VipsScaler.php
@@ -40,6 +40,9 @@
4141 $wgExtensionAliasesFiles['VipsTest'] = "$dir/VipsScaler.alias.php";
4242 $wgExtensionMessagesFiles['VipsScaler'] = "$dir/VipsScaler.i18n.php";
4343
 44+$wgAvailableRights[] = 'vipsscaler-test';
 45+$wgGroupPermissions['*']['vipsscaler-test'] = true;
 46+
4447 $wgHooks['BitmapHandlerTransform'][] = 'VipsScaler::onTransform';
4548 $wgHooks['BitmapHandlerCheckImageArea'][] = 'VipsScaler::onBitmapHandlerCheckImageArea';
4649
Index: trunk/extensions/VipsScaler/SpecialVipsTest.php
@@ -26,7 +26,7 @@
2727 */
2828 class SpecialVipsTest extends SpecialPage {
2929 public function __construct() {
30 - parent::__construct( 'VipsTest', 'vipstest' );
 30+ parent::__construct( 'VipsTest', 'vipsscaler-test' );
3131 }
3232
3333 /**
@@ -36,6 +36,11 @@
3737 public function execute( $par ) {
3838 $request = $this->getRequest();
3939
 40+ if( !$this->userCanExecute( $this->getUser() ) ) {
 41+ $this->displayRestrictionError();
 42+ return;
 43+ }
 44+
4045 if ( $request->getText( 'thumb' ) && $request->getText( 'file' ) ) {
4146 $this->streamThumbnail();
4247 } elseif ( $par || $request->getText( 'file' ) ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r101825add description for vipsscaler-test user right...hashar15:49, 3 November 2011

Comments

#Comment by Nikerabbit (talk | contribs)   15:24, 3 November 2011

Rights should have right-rightname and sometimes action-rightname messages.

#Comment by Hashar (talk | contribs)   15:49, 3 November 2011

Described in follow up r101825.

#Comment by Bryan (talk | contribs)   22:12, 3 November 2011

Why does this need to be restricted?

#Comment by Hashar (talk | contribs)   11:28, 7 November 2011

Because you originally implemented it as requiring a special right?

- parent::__construct( 'VipsTest', 'vipstest' );
+ parent::__construct( 'VipsTest', 'vipsscaler-test' );

I have just changed the right name and fixed the permissions. By default no one could use the test page.

Status & tagging log