mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 01:39:30 +02:00
Implement access restriction for special page.
This commit is contained in:
@ -59,8 +59,12 @@
|
|||||||
$wgAutoloadClasses['LinkTitles'] = dirname( __FILE__ ) . '/LinkTitles.body.php';
|
$wgAutoloadClasses['LinkTitles'] = dirname( __FILE__ ) . '/LinkTitles.body.php';
|
||||||
$wgAutoloadClasses['SpecialLinkTitles'] = dirname( __FILE__ ) . '/SpecialLinkTitles.php';
|
$wgAutoloadClasses['SpecialLinkTitles'] = dirname( __FILE__ ) . '/SpecialLinkTitles.php';
|
||||||
$wgExtensionFunctions[] = 'LinkTitles::setup';
|
$wgExtensionFunctions[] = 'LinkTitles::setup';
|
||||||
|
|
||||||
|
// Settings for the batch-processing special page
|
||||||
$wgSpecialPages['LinkTitles'] = 'SpecialLinkTitles';
|
$wgSpecialPages['LinkTitles'] = 'SpecialLinkTitles';
|
||||||
$wgSpecialPageGroups['LinkTitles'] = 'other';
|
$wgSpecialPageGroups['LinkTitles'] = 'other';
|
||||||
|
$wgGroupPermissions['sysop']['linktitles-batch'] = true;
|
||||||
|
$wgAvailableRights[] = 'linktitles-batch';
|
||||||
|
|
||||||
// vim: ts=2:sw=2:noet
|
// vim: ts=2:sw=2:noet
|
||||||
|
|
||||||
|
@ -2,10 +2,19 @@
|
|||||||
class SpecialLinkTitles extends SpecialPage {
|
class SpecialLinkTitles extends SpecialPage {
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
parent::__construct('LinkTitles');
|
// the second parameter in the following function call ensures that only
|
||||||
|
// users who have the 'linktitles-batch' right get to see this page (by
|
||||||
|
// default, this are all sysop users).
|
||||||
|
parent::__construct('LinkTitles', 'linktitles-batch');
|
||||||
}
|
}
|
||||||
|
|
||||||
function execute($par) {
|
function execute($par) {
|
||||||
|
// Prevent non-authorized users from executing the batch processing.
|
||||||
|
if ( !$this->userCanExecute( $this->getUser() ) ) {
|
||||||
|
$this->displayRestrictionError();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$output = $this->getOutput();
|
$output = $this->getOutput();
|
||||||
$this->setHeaders();
|
$this->setHeaders();
|
||||||
|
Reference in New Issue
Block a user