Index: trunk/extensions/PageSchemas/PS_Tabs.php |
— | — | @@ -21,13 +21,15 @@ |
22 | 22 | $pageSchemaObj = new PSSchema( $category ); |
23 | 23 | $isPSDefined = $pageSchemaObj->isPSDefined(); |
24 | 24 | |
25 | | - global $wgRequest; |
| 25 | + global $wgTitle, $wgRequest; |
26 | 26 | |
27 | | - $content_actions['editschema'] = array( |
28 | | - 'text' => ( $isPSDefined ) ? wfMsg( 'editschema' ) : wfMsg( 'createschema' ), |
29 | | - 'class' => $wgRequest->getVal( 'action' ) == 'editschema' ? 'selected' : '', |
30 | | - 'href' => $title->getLocalURL( 'action=editschema' ) |
31 | | - ); |
| 27 | + if ( $wgUser->isAllowed( 'edit' ) && $wgTitle->userCan( 'edit' ) ) { |
| 28 | + $content_actions['editschema'] = array( |
| 29 | + 'text' => ( $isPSDefined ) ? wfMsg( 'editschema' ) : wfMsg( 'createschema' ), |
| 30 | + 'class' => $wgRequest->getVal( 'action' ) == 'editschema' ? 'selected' : '', |
| 31 | + 'href' => $title->getLocalURL( 'action=editschema' ) |
| 32 | + ); |
| 33 | + } |
32 | 34 | |
33 | 35 | if ( $isPSDefined && $wgUser->isAllowed( 'generatepages' ) ) { |
34 | 36 | $content_actions['generatepages'] = array( |
Index: trunk/extensions/PageSchemas/specials/PS_EditSchema.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | |
10 | 10 | class PSEditSchema extends IncludableSpecialPage { |
11 | 11 | function __construct() { |
12 | | - parent::__construct( 'EditSchema' ); |
| 12 | + parent::__construct( 'EditSchema', 'edit' ); |
13 | 13 | } |
14 | 14 | |
15 | 15 | /** |
— | — | @@ -457,9 +457,16 @@ |
458 | 458 | } |
459 | 459 | |
460 | 460 | function execute( $category ) { |
461 | | - global $wgRequest, $wgOut, $wgUser; |
462 | | - global $wgSkin; |
| 461 | + global $wgRequest, $wgOut, $wgUser, $wgTitle; |
463 | 462 | |
| 463 | + // Only display this page if user is allowed to edit the |
| 464 | + // category page. |
| 465 | + if ( !$wgUser->isAllowed( 'edit' ) || !$wgTitle->userCan( 'edit' ) ) { |
| 466 | + $wgOut->permissionRequired( 'edit' ); |
| 467 | + return; |
| 468 | + } |
| 469 | + |
| 470 | + |
464 | 471 | $this->setHeaders(); |
465 | 472 | $text = '<p>' . wfMsg( 'ps-page-desc-edit-schema' ) . '</p>'; |
466 | 473 | PageSchemas::addJavascriptAndCSS(); |