diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-06-06 11:42:53 -0700 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-06-06 14:42:53 -0400 |
commit | 04088009f843c863d9f54b2a2c5b45b7f7e3ba9e (patch) | |
tree | 7995eae942b2868783d2b6951bb7ebe7ff445078 /cmd/platform/user.go | |
parent | 78ebf19dc1146be12ad73426802b24e87188cc72 (diff) | |
download | chat-04088009f843c863d9f54b2a2c5b45b7f7e3ba9e.tar.gz chat-04088009f843c863d9f54b2a2c5b45b7f7e3ba9e.tar.bz2 chat-04088009f843c863d9f54b2a2c5b45b7f7e3ba9e.zip |
Adding force flag to migrate auth command (#6593)
Diffstat (limited to 'cmd/platform/user.go')
-rw-r--r-- | cmd/platform/user.go | 6 |
1 files changed, 5 insertions, 1 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.") |