r77853 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77852‎ | r77853 | r77854 >
Date:02:14, 6 December 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Fixed rights for admin special pages
Modified paths:
  • /trunk/extensions/DSMW/DSMW_Settings.php (modified) (history)
  • /trunk/extensions/DSMW/patch (deleted) (history)
  • /trunk/extensions/DSMW/specials/ArticleAdminPage.php (modified) (history)
  • /trunk/extensions/DSMW/specials/DSMWAdmin.php (modified) (history)
  • /trunk/extensions/DSMW/specials/DSMWGeneralExhibits.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DSMW/DSMW_Settings.php
@@ -35,14 +35,8 @@
3636 $wgGroupPermissions['*']['editchangeset'] = false;
3737 $wgGroupPermissions['sysop']['editchangeset'] = true;
3838
39 -
40 -$wgGroupPermissions['*']['ArticleAdminPage'] = true;// sysop
4139 require_once( dirname( __FILE__ ) . '/specials/ArticleAdminPage.php' );
42 -
43 -$wgGroupPermissions['*']['DSMWAdmin'] = true;// sysop
4440 require_once( dirname( __FILE__ ) . '/specials/DSMWAdmin.php' );
45 -
46 -$wgGroupPermissions['*']['DSMWGeneralExhibits'] = true;// sysop
4741 require_once( dirname( __FILE__ ) . '/specials/DSMWGeneralExhibits.php' );
4842
4943 // semantic mediawiki extension
Index: trunk/extensions/DSMW/specials/ArticleAdminPage.php
@@ -17,7 +17,7 @@
1818 $wgHooks["SkinTemplateTabs"][] = $this;
1919 $wgHooks['SkinTemplateNavigation'][] = $this;
2020
21 - parent::__construct( 'ArticleAdminPage' );
 21+ parent::__construct( 'ArticleAdminPage', 'delete' );
2222 }
2323
2424 public function getDescription() {
@@ -35,8 +35,14 @@
3636 * @return <bool>
3737 */
3838 public function execute() {
39 - global $wgOut, $wgServerName, $wgScriptPath, $wgScriptExtension; /*, $wgSitename, $wgCachePages, $wgUser, $wgTitle, $wgDenyAccessMessage, $wgAllowAnonUsers, $wgRequest, $wgMessageCache, $wgWatchingMessages, $wgDBtype, $namespace_titles;*/
 39+ global $wgOut, $wgServerName, $wgScriptPath, $wgScriptExtension, $wgUser;
4040
 41+ if ( !$this->userCanExecute( $wgUser ) ) {
 42+ // If the user is not authorized, show an error.
 43+ $this->displayRestrictionError();
 44+ return;
 45+ }
 46+
4147 $url = 'http://' . $wgServerName . $wgScriptPath . "/index{$wgScriptExtension}";
4248 $urlServer = 'http://' . $wgServerName . $wgScriptPath;
4349 // $wgOut->addHeadItem('script', ArticleAdminPage::javascript());
Index: trunk/extensions/DSMW/specials/DSMWAdmin.php
@@ -16,7 +16,7 @@
1717 # Add all our needed hooks
1818 $wgHooks['SkinTemplateTabs'][] = $this;
1919
20 - parent::__construct( 'DSMWAdmin' );
 20+ parent::__construct( 'DSMWAdmin', 'delete' );
2121 }
2222
2323 public function getDescription() {
@@ -34,8 +34,14 @@
3535 * @return <bool>
3636 */
3737 public function execute() {
38 - global $wgOut, $wgRequest, $wgServerName, $wgScriptPath, $wgDSMWIP, $wgServerName, $wgScriptPath;
 38+ global $wgOut, $wgRequest, $wgServerName, $wgScriptPath, $wgDSMWIP, $wgServerName, $wgScriptPath, $wgUser;
3939
 40+ if ( !$this->userCanExecute( $wgUser ) ) {
 41+ // If the user is not authorized, show an error.
 42+ $this->displayRestrictionError();
 43+ return;
 44+ }
 45+
4046 /**** Get status of refresh job, if any ****/
4147 $dbr =& wfGetDB( DB_SLAVE );
4248 $row = $dbr->selectRow( 'job', '*', array( 'job_cmd' => 'DSMWUpdateJob' ), __METHOD__ );
Index: trunk/extensions/DSMW/specials/DSMWGeneralExhibits.php
@@ -12,7 +12,7 @@
1313 class DSMWGeneralExhibits extends SpecialPage {
1414
1515 public function __construct() {
16 - parent::__construct( 'DSMWGeneralExhibits' );
 16+ parent::__construct( 'DSMWGeneralExhibits', 'delete' );
1717 }
1818
1919 public function getDescription() {
@@ -27,8 +27,14 @@
2828 * There are 3 links used to see informations about Patches, PullFeeds or PushFeeds
2929 */
3030 public function execute() {
31 - global $wgOut, $wgRequest;
 31+ global $wgOut, $wgRequest, $wgUser;
3232
 33+ if ( !$this->userCanExecute( $wgUser ) ) {
 34+ // If the user is not authorized, show an error.
 35+ $this->displayRestrictionError();
 36+ return;
 37+ }
 38+
3339 $output = '<p>This page displays general informations about Distributed Semantic MediaWiki.</p>';
3440
3541 $returntitle1 = Title::makeTitle( NS_SPECIAL, 'DSMWGeneralExhibits' );

Status & tagging log