This lets any group(s) be added using a comma-separated argument,
in addition to the --sysop, --bureaucrat, and --bot that already
existed.
Bug: T105079
Change-Id: I1274b065e3dad917e545f9278b996da014d87ae9
foreach ( self::$permitRoles as $role ) {
$this->addOption( $role, "Add the account to the {$role} group" );
}
foreach ( self::$permitRoles as $role ) {
$this->addOption( $role, "Add the account to the {$role} group" );
}
+
+ $this->addOption(
+ 'custom-groups',
+ 'Comma-separated list of groups to add the user to',
+ false,
+ true
+ );
+
$this->addArg( "username", "Username of new user" );
$this->addArg( "password", "Password to set (not required if --force is used)", false );
}
$this->addArg( "username", "Username of new user" );
$this->addArg( "password", "Password to set (not required if --force is used)", false );
}
$inGroups = $user->getGroups();
}
$inGroups = $user->getGroups();
}
+ $groups = array_filter( self::$permitRoles, array( $this, 'hasOption' ) );
+ if ( $this->hasOption( 'custom-groups' ) ) {
+ $customGroupsText = $this->getOption( 'custom-groups' );
+ if ( $customGroupsText !== '' ) {
+ $customGroups = explode( ',', $customGroupsText );
+ foreach ( $customGroups as $customGroup ) {
+ $groups[] = trim( $customGroup );
+ }
+ }
+ }
+
$promotions = array_diff(
$promotions = array_diff(
- array_filter( self::$permitRoles, array( $this, 'hasOption' ) ),