Ljonka has uploaded a new change for review.
https://gerrit.wikimedia.org/r/304002
Change subject: PermissionManager: move to special page and register own
permission
......................................................................
PermissionManager: move to special page and register own permission
Change-Id: I7317e138847398ca071c39bd3fd8e6e4d048c79a
---
M PermissionManager/PermissionManager.class.php
M PermissionManager/PermissionManager.setup.php
M PermissionManager/i18n/en.json
M PermissionManager/i18n/qqq.json
A PermissionManager/includes/specials/SpecialPermissionManager.alias.php
A PermissionManager/includes/specials/SpecialPermissionManager.class.php
6 files changed, 119 insertions(+), 4 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions
refs/changes/02/304002/1
diff --git a/PermissionManager/PermissionManager.class.php
b/PermissionManager/PermissionManager.class.php
index d7a633c..7044eb6 100644
--- a/PermissionManager/PermissionManager.class.php
+++ b/PermissionManager/PermissionManager.class.php
@@ -134,6 +134,8 @@
$this->setHook( 'BSGroupManagerGroupNameChanged' );
$this->setHook( 'BSGroupManagerGroupDeleted' );
+
+ $this->mCore->registerPermission(
'permissionmanager-viewspecialpage', array('sysop'), array( 'type' => 'global'
) );
}
/**
diff --git a/PermissionManager/PermissionManager.setup.php
b/PermissionManager/PermissionManager.setup.php
index df45c31..938cdc1 100644
--- a/PermissionManager/PermissionManager.setup.php
+++ b/PermissionManager/PermissionManager.setup.php
@@ -48,6 +48,11 @@
$wgAutoloadClasses['PermissionManager'] = __DIR__ .
'/PermissionManager.class.php';
$wgAutoloadClasses['PermissionTemplates'] = __DIR__ .
'/includes/PermissionTemplates.class.php';
$wgAutoloadClasses['PermissionValidator'] = __DIR__ .
'/includes/PermissionValidator.php';
+$wgAutoloadClasses['SpecialPermissionManager'] = __DIR__ .
'/includes/specials/SpecialPermissionManager.class.php';
+$wgExtensionMessagesFiles['PermissionManagerAlias'] = __DIR__ .
'/includes/specials/SpecialPermissionManager.alias.php';
+
+//register specialpage for permissionmanager
+$wgSpecialPages['PermissionManager'] = 'SpecialPermissionManager';
// Map class name to filename for autoloading
$wgAutoloadClasses['ApiPermissionManager'] = __DIR__ .
'/includes/api/ApiPermissionManager.php';
diff --git a/PermissionManager/i18n/en.json b/PermissionManager/i18n/en.json
index 25f80a2..833369f 100644
--- a/PermissionManager/i18n/en.json
+++ b/PermissionManager/i18n/en.json
@@ -1,7 +1,8 @@
{
"@metadata": {
"authors": [
- "Stephan Muggli <[email protected]>"
+ "Stephan Muggli <[email protected]>",
+ "Leonid Verhovskij <[email protected]>"
]
},
"bs-permissionmanager-desc": "Administration interface for editing user
rights",
@@ -46,5 +47,7 @@
"log-description-bs-permission-manager": "This is a log of changes in
the group permissions.",
"log-show-hide-bs-permission-manager": "$1 permission manager log",
"logentry-bs-permission-manager-modify": "$1 {{GENDER:$2|has}} changed
the permissions of the group $4",
- "apihelp-bs-permissionmanager-tasks-description": "Provides tasks for
the PermissionManager"
+ "apihelp-bs-permissionmanager-tasks-description": "Provides tasks for
the PermissionManager",
+ "action-permissionmanager-viewspecialpage":"view the special page
\"{{int:bs-permissionmanager-label}}\"",
+ "permissionmanager":"Permission manager"
}
diff --git a/PermissionManager/i18n/qqq.json b/PermissionManager/i18n/qqq.json
index 68f96b5..4d2bae5 100644
--- a/PermissionManager/i18n/qqq.json
+++ b/PermissionManager/i18n/qqq.json
@@ -3,7 +3,8 @@
"authors": [
"Stephan Muggli <[email protected]>",
"Liuxinyu970226",
- "Shirayuki"
+ "Shirayuki",
+ "Leonid Verhovskij <[email protected]>"
]
},
"bs-permissionmanager-desc": "Used in
[{{canonicalurl:Special:WikiAdmin|mode=ExtensionInfo}}
Special:WikiAdmin?mode=ExtensionInfo], description of permission manager
extension",
@@ -48,5 +49,7 @@
"log-description-bs-permission-manager": "Used in [[Special:Log]],
description of the log type",
"log-show-hide-bs-permission-manager": "Used in [[Special:Log]].
Parameters:\n* $1 - link text; one of {{msg-mw|Show}} or
{{msg-mw|Hide}}\n{{Related|Log-show-hide}}",
"logentry-bs-permission-manager-modify": "Log message about changes in
the permissions of one specific group.\nParameters:\n* $4 - name of the group",
- "apihelp-bs-permissionmanager-tasks-description": "Describes an API
endpoint that provides tasks for the PermissionManager"
+ "apihelp-bs-permissionmanager-tasks-description": "Describes an API
endpoint that provides tasks for the PermissionManager",
+ "action-permissionmanager-viewspecialpage": "placeholder to describe
that view of special page \"{{int:bs-permissionmanager-label}}\" is restricted
for the current user",
+ "permissionmanager":"Anchor text for permission
manager\n{{Identical|Permission manager}}"
}
diff --git
a/PermissionManager/includes/specials/SpecialPermissionManager.alias.php
b/PermissionManager/includes/specials/SpecialPermissionManager.alias.php
new file mode 100644
index 0000000..1a76308
--- /dev/null
+++ b/PermissionManager/includes/specials/SpecialPermissionManager.alias.php
@@ -0,0 +1,12 @@
+<?php
+$specialPageAliases = array();
+
+/** English */
+$specialPageAliases['en'] = array(
+ 'PermissionManager' => array( 'PermissionManager', 'Permission Manager'
),
+);
+
+/** German (Deutsch) */
+$specialPageAliases['de'] = array(
+ 'PermissionManager' => array( 'PermissionManager', 'Permission
Manager', 'Rechteverwaltung', 'Rechtemanager' ),
+);
diff --git
a/PermissionManager/includes/specials/SpecialPermissionManager.class.php
b/PermissionManager/includes/specials/SpecialPermissionManager.class.php
new file mode 100644
index 0000000..cc0cd14
--- /dev/null
+++ b/PermissionManager/includes/specials/SpecialPermissionManager.class.php
@@ -0,0 +1,90 @@
+<?php
+
+class SpecialPermissionManager extends BsSpecialPage {
+
+ public function __construct() {
+ parent::__construct( 'PermissionManager',
'permissionmanager-viewspecialpage' );
+
+ }
+
+ /**
+ *
+ * @global OutputPage $this->getOutput()
+ * @param type $sParameter
+ * @return type
+ */
+ public function execute( $sParameter ) {
+ parent::execute( $sParameter );
+ global $wgImplicitGroups, $wgGroupPermissions,
$wgNamespacePermissionLockdown;
+
+ $this->getOutput()->setPageTitle(
wfMessage('bs-permissionmanager-label' )->inContentLanguage() );
+
+ $this->getOutput()->addModules(
'ext.bluespice.permissionManager' );
+
+ $aGroups = array(
+ 'text' => '*',
+ 'builtin' => true,
+ 'implicit' => true,
+ 'expanded' => true,
+ 'children' => array(
+ array(
+ 'text' => 'user',
+ 'builtin' => true,
+ 'implicit' => true,
+ 'expanded' => true,
+ 'children' => array()
+ )
+ )
+ );
+
+ $aExplicitGroups = BsGroupHelper::getAvailableGroups(
+ array( 'blacklist' => $wgImplicitGroups )
+ );
+
+ sort( $aExplicitGroups );
+
+ $aExplicitGroupNodes = array();
+ foreach ( $aExplicitGroups as $sExplicitGroup ) {
+ $aExplicitGroupNode = array(
+ 'text' => $sExplicitGroup,
+ 'leaf' => true
+ );
+
+ if ( in_array( $sExplicitGroup,
PermissionManager::$aBuiltInGroups ) ) {
+ $aExplicitGroupNode[ 'builtin' ] = true;
+ }
+
+ $aExplicitGroupNodes[] = $aExplicitGroupNode;
+ }
+
+ $aGroups[ 'children' ][ 0 ][ 'children' ] =
$aExplicitGroupNodes;
+
+ $aJsVars = array(
+ 'bsPermissionManagerGroupsTree' => $aGroups,
+ 'bsPermissionManagerNamespaces' =>
PermissionManager::buildNamespaceMetadata(),
+ 'bsPermissionManagerRights' =>
PermissionManager::buildRightsMetadata(),
+ 'bsPermissionManagerGroupPermissions' =>
$wgGroupPermissions,
+ 'bsPermissionManagerPermissionLockdown' =>
$wgNamespacePermissionLockdown,
+ 'bsPermissionManagerPermissionTemplates' =>
PermissionManager::getTemplateRules()
+ );
+
+ wfRunHooks( 'BsPermissionManager::beforeLoadPermissions',
array( &$aJsVars ) );
+
+ //Make sure a new group without any explicit permissions is
converted into an object!
+ //Without any key => value it would be converted into an empty
array.
+ foreach ( $aJsVars[ 'bsPermissionManagerGroupPermissions' ] as
$sGroup => $aPermissions ) {
+ if ( !empty( $aPermissions ) )
+ continue;
+ $aJsVars[ 'bsPermissionManagerGroupPermissions' ][
$sGroup ] = ( object ) array();
+ }
+
+ $this->getOutput()->addJsConfigVars( $aJsVars );
+
+ $this->getOutput()->addHTML( '<div id="panelPermissionManager"
style="height: 500px"></div>' );
+ }
+
+ protected function getGroupName() {
+ return 'bluespice';
+ }
+
+}
--
To view, visit https://gerrit.wikimedia.org/r/304002
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7317e138847398ca071c39bd3fd8e6e4d048c79a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Ljonka <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits