summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-06-06 11:42:53 -0700
committerJoram Wilander <jwawilander@gmail.com>2017-06-06 14:42:53 -0400
commit04088009f843c863d9f54b2a2c5b45b7f7e3ba9e (patch)
tree7995eae942b2868783d2b6951bb7ebe7ff445078
parent78ebf19dc1146be12ad73426802b24e87188cc72 (diff)
downloadchat-04088009f843c863d9f54b2a2c5b45b7f7e3ba9e.tar.gz
chat-04088009f843c863d9f54b2a2c5b45b7f7e3ba9e.tar.bz2
chat-04088009f843c863d9f54b2a2c5b45b7f7e3ba9e.zip
Adding force flag to migrate auth command (#6593)
-rw-r--r--cmd/platform/user.go6
-rw-r--r--einterfaces/account_migration.go2
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