Index: trunk/extensions/PageSchemas/PS_Tabs.php |
— | — | @@ -1,12 +1,13 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | /** |
5 | | - * @file PSTabs.php |
| 5 | + * @file PS_Tabs.php |
6 | 6 | * @ingroup |
7 | 7 | * |
8 | | - * @author ankit |
| 8 | + * @author Ankit Garg |
| 9 | + * @author Yaron Koren |
9 | 10 | */ |
10 | | - final class PSTabs { |
| 11 | +final class PSTabs { |
11 | 12 | |
12 | 13 | public static function displayTabs( $obj, &$content_actions ) { |
13 | 14 | global $wgUser; |
— | — | @@ -28,7 +29,7 @@ |
29 | 30 | 'href' => $title->getLocalURL( 'action=editschema' ) |
30 | 31 | ); |
31 | 32 | |
32 | | - if ( $isPSDefined ) { |
| 33 | + if ( $isPSDefined && $wgUser->isAllowed( 'generatepages' ) ) { |
33 | 34 | $content_actions['generatepages'] = array( |
34 | 35 | 'text' => wfMsg( 'generatepages' ), |
35 | 36 | 'class' => $wgRequest->getVal( 'action' ) == 'generatepages' ? 'selected' : '', |
Index: trunk/extensions/PageSchemas/specials/PS_GeneratePages.php |
— | — | @@ -10,12 +10,17 @@ |
11 | 11 | |
12 | 12 | class PSGeneratePages extends IncludableSpecialPage { |
13 | 13 | function __construct() { |
14 | | - parent::__construct( 'GeneratePages' ); |
| 14 | + parent::__construct( 'GeneratePages', 'generatepages' ); |
15 | 15 | } |
16 | 16 | |
17 | 17 | function execute( $category ) { |
18 | | - global $wgRequest, $wgOut, $wgPageSchemasHandlerClasses; |
| 18 | + global $wgUser, $wgRequest, $wgOut, $wgPageSchemasHandlerClasses; |
19 | 19 | |
| 20 | + if ( ! $wgUser->isAllowed( 'generatepages' ) ) { |
| 21 | + $wgOut->permissionRequired( 'generatepages' ); |
| 22 | + return; |
| 23 | + } |
| 24 | + |
20 | 25 | $this->setHeaders(); |
21 | 26 | $param = $wgRequest->getText('param'); |
22 | 27 | if ( !empty( $param ) && !empty( $category ) ) { |
Index: trunk/extensions/PageSchemas/PageSchemas.php |
— | — | @@ -19,12 +19,14 @@ |
20 | 20 | |
21 | 21 | /* Configuration */ |
22 | 22 | |
| 23 | +define( 'PAGE_SCHEMAS_VERSION', '0.2' ); |
| 24 | + |
23 | 25 | // Credits |
24 | 26 | $wgExtensionCredits['parserhook'][] = array( |
25 | 27 | 'path' => __FILE__, |
26 | 28 | 'name' => 'Page Schemas', |
27 | 29 | 'author' => array( 'Ankit Garg', 'Yaron Koren' ), |
28 | | - 'version' => '0.2', |
| 30 | + 'version' => PAGE_SCHEMAS_VERSION, |
29 | 31 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Page_Schemas', |
30 | 32 | 'descriptionmsg' => 'ps-desc', |
31 | 33 | ); |
— | — | @@ -64,6 +66,10 @@ |
65 | 67 | $wgHooks['SkinTemplateTabs'][] = 'PSTabs::displayTabs'; |
66 | 68 | $wgHooks['SkinTemplateNavigation'][] = 'PSTabs::displayTabs2'; |
67 | 69 | |
| 70 | +// User right for viewing the 'Generate pages' page |
| 71 | +$wgAvailableRights[] = 'generatepages'; |
| 72 | +$wgGroupPermissions['sysop']['generatepages'] = true; |
| 73 | + |
68 | 74 | // Register client-side modules |
69 | 75 | $pageSchemasResourceTemplate = array( |
70 | 76 | 'localBasePath' => $dir, |