diff options
-rw-r--r-- | cmd/platform/user.go | 6 | ||||
-rw-r--r-- | einterfaces/account_migration.go | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/cmd/platform/user.go b/cmd/platform/user.go index 74e71ebe3..93fce3867 100644 --- a/cmd/platform/user.go +++ b/cmd/platform/user.go @@ -141,6 +141,8 @@ func init() { deleteAllUsersCmd.Flags().Bool("confirm", false, "Confirm you really want to delete the user and a DB backup has been performed.") + migrateAuthCmd.Flags().Bool("force", false, "Force the migration to occour even if there are duplicates on the LDAP server. Duplicates will not be migrated.") + userCmd.AddCommand( userActivateCmd, userDeactivateCmd, @@ -444,8 +446,10 @@ func migrateAuthCmdF(cmd *cobra.Command, args []string) error { return errors.New("Invalid match_field argument") } + forceFlag, _ := cmd.Flags().GetBool("force") + if migrate := einterfaces.GetAccountMigrationInterface(); migrate != nil { - if err := migrate.MigrateToLdap(fromAuth, matchField); err != nil { + if err := migrate.MigrateToLdap(fromAuth, matchField, forceFlag); err != nil { return errors.New("Error while migrating users: " + err.Error()) } else { CommandPrettyPrintln("Sucessfully migrated accounts.") diff --git a/einterfaces/account_migration.go b/einterfaces/account_migration.go index a52b5e348..c9534ab68 100644 --- a/einterfaces/account_migration.go +++ b/einterfaces/account_migration.go @@ -6,7 +6,7 @@ package einterfaces import "github.com/mattermost/platform/model" type AccountMigrationInterface interface { - MigrateToLdap(fromAuthService string, forignUserFieldNameToMatch string) *model.AppError + MigrateToLdap(fromAuthService string, forignUserFieldNameToMatch string, force bool) *model.AppError } var theAccountMigrationInterface AccountMigrationInterface |