'Ancientpages' => array( 'SpecialPage', 'Ancientpages' ),
'Deadendpages' => array( 'SpecialPage', 'Deadendpages' ),
'Protectedpages' => array( 'SpecialPage', 'Protectedpages' ),
- 'Protectedtitles' => array( 'SpecialPage', 'Protectedtitles' ),
+ 'Protectedtitles' => array( 'SpecialPage', 'Protectedtitles' ),
'Allpages' => array( 'IncludableSpecialPage', 'Allpages' ),
'Prefixindex' => array( 'IncludableSpecialPage', 'Prefixindex' ) ,
'Ipblocklist' => array( 'SpecialPage', 'Ipblocklist' ),
'Import' => array( 'SpecialPage', 'Import', 'import' ),
'Lockdb' => array( 'SpecialPage', 'Lockdb', 'siteadmin' ),
'Unlockdb' => array( 'SpecialPage', 'Unlockdb', 'siteadmin' ),
- 'Userrights' => array( 'SpecialPage', 'Userrights', 'userrights' ),
+ 'Userrights' => 'UserrightsPage',
'MIMEsearch' => array( 'SpecialPage', 'MIMEsearch' ),
'Unwatchedpages' => array( 'SpecialPage', 'Unwatchedpages', 'unwatchedpages' ),
'Listredirects' => array( 'SpecialPage', 'Listredirects' ),
foreach ( self::$mList as $name => $rec ) {
$page = self::getPage( $name );
- if ( $page->isListed() && $page->getRestriction() == '' ) {
+ if ( $page->isListed() && !$page->isRestricted() ) {
$pages[$name] = $page;
}
}
foreach ( self::$mList as $name => $rec ) {
$page = self::getPage( $name );
- if ( $page->isListed() ) {
- $restriction = $page->getRestriction();
- if ( $restriction != '' && $wgUser->isAllowed( $restriction ) ) {
- $pages[$name] = $page;
- }
+ if (
+ $page->isListed()
+ and $page->isRestricted()
+ and $page->userCanExecute( $wgUser )
+ ) {
+ $pages[$name] = $page;
}
}
return $pages;
return $this->mLocalName;
}
+ /**
+ * Can be overridden by subclasses with more complicated permissions
+ * schemes.
+ *
+ * @return bool Should the page be displayed with the restricted-access
+ * pages?
+ */
+ public function isRestricted() {
+ return $this->mRestriction != '';
+ }
+
/**
* Checks if the given user (identified by an object) can execute this
- * special page (as defined by $mRestriction)
+ * special page (as defined by $mRestriction). Can be overridden by sub-
+ * classes with more complicated permissions schemes.
+ *
+ * @param User $user The user to check
+ * @return bool Does the user have permission to view the page?
*/
- function userCanExecute( &$user ) {
+ public function userCanExecute( $user ) {
return $user->isAllowed( $this->mRestriction );
}