summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/commands/ldap.go29
-rw-r--r--cmd/commands/server.go2
2 files changed, 30 insertions, 1 deletions
diff --git a/cmd/commands/ldap.go b/cmd/commands/ldap.go
index 0c79ce32b..03c366213 100644
--- a/cmd/commands/ldap.go
+++ b/cmd/commands/ldap.go
@@ -22,9 +22,19 @@ var LdapSyncCmd = &cobra.Command{
RunE: ldapSyncCmdF,
}
+var LdapIdMigrate = &cobra.Command{
+ Use: "idmigrate",
+ Short: "Migrate LDAP IdAttribute to new value",
+ Long: "Migrate LDAP IdAttribute to new value. Run this utility then change the IdAttribute to the new value.",
+ Example: " ldap idmigrate objectGUID",
+ Args: cobra.ExactArgs(1),
+ RunE: ldapIdMigrateCmdF,
+}
+
func init() {
LdapCmd.AddCommand(
LdapSyncCmd,
+ LdapIdMigrate,
)
cmd.RootCmd.AddCommand(LdapCmd)
}
@@ -47,3 +57,22 @@ func ldapSyncCmdF(command *cobra.Command, args []string) error {
return nil
}
+
+func ldapIdMigrateCmdF(command *cobra.Command, args []string) error {
+ a, err := cmd.InitDBCommandContextCobra(command)
+ if err != nil {
+ return err
+ }
+ defer a.Shutdown()
+
+ toAttribute := args[0]
+ if ldapI := a.Ldap; ldapI != nil {
+ if err := ldapI.MigrateIDAttribute(toAttribute); err != nil {
+ cmd.CommandPrintErrorln("ERROR: AD/LDAP IdAttribute migration failed! Error: " + err.Error())
+ } else {
+ cmd.CommandPrettyPrintln("SUCCESS: AD/LDAP IdAttribute migration complete. You can now change your IdAttribute to: " + toAttribute)
+ }
+ }
+
+ return nil
+}
diff --git a/cmd/commands/server.go b/cmd/commands/server.go
index 77f195f4b..441eb82bc 100644
--- a/cmd/commands/server.go
+++ b/cmd/commands/server.go
@@ -107,7 +107,7 @@ func runServer(configFileLocation string, disableConfigWatch bool, interruptChan
api4.Init(a, a.Srv.Router, false)
api3 := api.Init(a, a.Srv.Router)
wsapi.Init(a, a.Srv.WebSocketRouter)
- web.Init(api3)
+ web.NewWeb(a, a.Srv.Router)
license := a.License()