Tweichart has submitted this change and it was merged.

Change subject: Added new global for better permission config
......................................................................


Added new global for better permission config

*$bsgPermissionConfig is for adding some configs to every permission
*in registerPermission I set check if a permission has the "type" set, if not
I set a default one.

Change-Id: I44787c6f5e4ec1161ff08735f86f499f96b346bc
---
M includes/Core.class.php
M includes/DefaultSettings.php
2 files changed, 116 insertions(+), 7 deletions(-)

Approvals:
  Tweichart: Verified; Looks good to me, approved



diff --git a/includes/Core.class.php b/includes/Core.class.php
index a587010..77a3ab9 100644
--- a/includes/Core.class.php
+++ b/includes/Core.class.php
@@ -526,23 +526,27 @@
         * @param String $sPermissionName I.e. 'myextension-dosomething'
         * @param Array $aUserGroups User groups that get preinitialized with 
the new
         * pemission. I.e. array( 'user', 'bureaucrats' )
+        * @param Array $aConfig set configs for permissions i.e. 
array('type'=>'global').
+        * The default here is ('type' = 'namespace')
         * @return void
         */
-       public function registerPermission( $sPermissionName, $aUserGroups = 
array() ) {
-               // TODO MRG (05.02.11 19:24): @Sebastian Ist der dritte 
Parameter im PermissionsManager berücksichtigt?
+       public function registerPermission( $sPermissionName, $aUserGroups = 
array(), $aConfig = array() ) {
                wfProfileIn('BS::' . __METHOD__);
-
-               global $wgGroupPermissions, $wgAvailableRights;
+               global $wgGroupPermissions, $wgAvailableRights, 
$bsgPermissionConfig;
                $wgGroupPermissions['sysop'][$sPermissionName] = true;
-
+               if(!isset($bsgPermissionConfig[$sPermissionName])){
+                       if ( isset( $aConfig ) ) {
+                               $bsgPermissionConfig[$sPermissionName] = 
$aConfig;
+                       } else {
+                               $bsgPermissionConfig[$sPermissionName] = array( 
'type' => 'namespace' );
+                       }
+               }
                foreach ( $aUserGroups as $sGroup ) {
                        if ( !isset( 
$wgGroupPermissions[$sGroup][$sPermissionName] ) ) {
                                $wgGroupPermissions[$sGroup][$sPermissionName] 
= true;
                        }
                }
-
                $wgAvailableRights[] = $sPermissionName;
-
                wfProfileOut('BS::' . __METHOD__);
        }
 
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 2dac392..73fdb0b 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -101,6 +101,111 @@
        )
 );
 
+$bsgPermissionConfig = array(
+       'read' => array(
+               'type' => 'namespace',
+               'preventLockout' => true
+       ),
+       'siteadmin' => array(
+               'type' => 'global',
+               'preventLockout' => true
+       ),
+       'wikiadmin' => array(
+               'type' => 'global',
+               'preventLockout' => true
+       ),
+       "apihighlimits" => array(
+               'type' => 'global'
+       ),
+       "autoconfirmed" => array(
+               'type' => 'global'
+       ),
+       "autopatrol" => array(
+               'type' => 'global'
+       ),
+       "bigdelete" => array(
+               'type' => 'global'
+       ),
+       "block" => array(
+               'type' => 'global'
+       ),
+       "blockemail" => array(
+               'type' => 'global'
+       ),
+       "bot" => array(
+               'type' => 'global'
+       ),
+       "browsearchive" => array(
+               'type' => 'global'
+       ),
+       "createaccount" => array(
+               'type' => 'global'
+       ),
+       "editinterface" => array(
+               'type' => 'global'
+       ),
+       "editusercssjs" => array(
+               'type' => 'global'
+       ),
+       "editusercss" => array(
+               'type' => 'global'
+       ),
+       "edituserjs" => array(
+               'type' => 'global'
+       ),
+       "hideuser" => array(
+               'type' => 'global'
+       ),
+       "import" => array(
+               'type' => 'global'
+       ),
+       "importupload" => array(
+               'type' => 'global'
+       ),
+       "ipblock-exempt" => array(
+               'type' => 'global'
+       ),
+       "move-rootuserpages" => array(
+               'type' => 'global'
+       ),
+       "override-export-depth" => array(
+               'type' => 'global'
+       ),
+       "passwordreset" => array(
+               'type' => 'global'
+       ),
+       "proxyunbannable" => array(
+               'type' => 'global'
+       ),
+       "sendemail" => array(
+               'type' => 'global'
+       ),
+       "unblockself" => array(
+               'type' => 'global'
+       ),
+       "userrights" => array(
+               'type' => 'global'
+       ),
+       "userrights-interwiki" => array(
+               'type' => 'global'
+       ),
+       "writeapi" => array(
+               'type' => 'global'
+       ),
+       "skipcaptcha" => array(
+               'type' => 'global'
+       ),
+       "renameuser" => array(
+               'type' => 'global'
+       ),
+       "viewfiles" => array(
+               'type' => 'global'
+       ),
+       "searchfiles"=> array(
+               'type' => 'global'
+       )
+);
+
 $bsgExtJSTheme = 'bluespice';
 
 unset($sResourcesPath);

-- 
To view, visit https://gerrit.wikimedia.org/r/192322
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I44787c6f5e4ec1161ff08735f86f499f96b346bc
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Jgoettlich <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Pigpen <[email protected]>
Gerrit-Reviewer: Pwirth <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: Tweichart <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to