CSteipp has submitted this change and it was merged.

Change subject: Apply title normalization for global groups
......................................................................


Apply title normalization for global groups

This won't break on wikimedia wikis as all groups so far are in
the normalized forms. I didn't built in a fancy error reporting
as these functions are barely used.

Change-Id: I80e3a3c62d7a9d333cf62bba4d3009b18008383f
---
M CentralAuth.i18n.php
M specials/SpecialGlobalGroupPermissions.php
2 files changed, 18 insertions(+), 1 deletion(-)

Approvals:
  CSteipp: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/CentralAuth.i18n.php b/CentralAuth.i18n.php
index 54d746d..b1a336f 100644
--- a/CentralAuth.i18n.php
+++ b/CentralAuth.i18n.php
@@ -325,6 +325,7 @@
        'centralauth-editgroup-name'                      => 'Name of group:',
        'centralauth-editgroup-display'                   => 'Localised name of 
group:',
        'centralauth-editgroup-display-edit'              => '$2 
([[MediaWiki:Group-$1|edit]])',
+       'centralauth-editgroup-invalid-name'              => 'Invalid global 
group name given',
        'centralauth-editgroup-member'                    => 'Localised name of 
group members:',
        'centralauth-editgroup-member-edit'               => '$2 
([[MediaWiki:Group-$1-member|edit]])',
        'centralauth-editgroup-members'                   => 'Member list:',
@@ -724,6 +725,7 @@
 * {{msg-mw|Centralauth-rightslog-set-optin}}',
        'centralauth-autologin-desc' => 'This is the text shown on 
[[Special:AutoLogin]] when this page is requested by a user, not by the 
automatic global login system.',
        'centralauth-globalgroupperms-newgroupname' => 'I think this needs to 
be translated as "Name of the new group", not as "New name of the group". – 
[[User:McDutchie|McDutchie]] 16:40, 20 July 2008 (UTC)',
+       'centralauth-editgroup-invalid-name'              => 'Error shown in 
case the name given for the global group is invalid',
        'centralauth-editgroup-subtitle' => 'Subtitle for 
Special:GlobalGroupPernissions for users who may edit these permission.
 
 Parameters:
diff --git a/specials/SpecialGlobalGroupPermissions.php 
b/specials/SpecialGlobalGroupPermissions.php
index 66ef338..da74e84 100644
--- a/specials/SpecialGlobalGroupPermissions.php
+++ b/specials/SpecialGlobalGroupPermissions.php
@@ -273,9 +273,24 @@
                }
                $reason = $this->getRequest()->getVal( 'wpReason', '' );
 
+               // Current name of the group
+               $group = Title::newFromText( $group );
+               if ( !$group ) {
+                       $this->getOutput()->addWikiMsg( 
'centralauth-editgroup-invalid-name' );
+                       return;
+               }
+               $group = $group->getPrefixedDBkey();
 
-               // Global group rename
+               // (Potentially) New name of the group
                $newname = $this->getRequest()->getVal( 'wpGlobalGroupName', 
$group );
+
+               $newname = Title::newFromText( $newname );
+               if ( !$newname ) {
+                       $this->getOutput()->addWikiMsg( 
'centralauth-editgroup-invalid-name' );
+                       return;
+               }
+               $newname = $newname->getPrefixedDBkey();
+
                if ( $group != $newname ) {
 
                        if ( in_array( $newname, 
CentralAuthUser::availableGlobalGroups() ) ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I80e3a3c62d7a9d333cf62bba4d3009b18008383f
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>
Gerrit-Reviewer: CSteipp <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to