jenkins-bot has submitted this change and it was merged.

Change subject: Don't allow createAndPromote.php to add users to invalid groups
......................................................................


Don't allow createAndPromote.php to add users to invalid groups

Bug: T131704
Change-Id: Ibe8839e62af8db002adea68ffa87b3adf2b505ea
---
M maintenance/createAndPromote.php
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Jforrester: Looks good to me, but someone else must approve
  Florianschmidtwelzow: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/maintenance/createAndPromote.php b/maintenance/createAndPromote.php
index 9abc297..848c2f7 100644
--- a/maintenance/createAndPromote.php
+++ b/maintenance/createAndPromote.php
@@ -79,11 +79,16 @@
 
                $groups = array_filter( self::$permitRoles, [ $this, 
'hasOption' ] );
                if ( $this->hasOption( 'custom-groups' ) ) {
+                       $allGroups = array_flip( User::getAllGroups() );
                        $customGroupsText = $this->getOption( 'custom-groups' );
                        if ( $customGroupsText !== '' ) {
                                $customGroups = explode( ',', $customGroupsText 
);
                                foreach ( $customGroups as $customGroup ) {
-                                       $groups[] = trim( $customGroup );
+                                       if ( isset( $allGroups[$customGroup] ) 
) {
+                                               $groups[] = trim( $customGroup 
);
+                                       } else {
+                                               $this->output( "$customGroup is 
not a valid group, ignoring!\n" );
+                                       }
                                }
                        }
                }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibe8839e62af8db002adea68ffa87b3adf2b505ea
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to