[MM-25651] api4/ldap: add migrateid (#14794)
* api4/ldap: add idmigrate * api4/ldap: add migrateid to local api * api4/ldap: improve migrate test * api4/ldap: add licence check
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e980dd7bd3
Коммит
ec78168242
@@ -746,6 +746,7 @@ type AppIface interface {
|
||||
MaxPostSize() int
|
||||
MessageExport() einterfaces.MessageExportInterface
|
||||
Metrics() einterfaces.MetricsInterface
|
||||
MigrateIdLDAP(toAttribute string) *model.AppError
|
||||
MoveCommand(team *model.Team, command *model.Command) *model.AppError
|
||||
MoveFile(oldPath, newPath string) *model.AppError
|
||||
NewClusterDiscoveryService() *ClusterDiscoveryService
|
||||
|
||||
15
app/ldap.go
15
app/ldap.go
@@ -160,3 +160,18 @@ func (a *App) SwitchLdapToEmail(ldapPassword, code, email, newPassword string) (
|
||||
|
||||
return "/login?extra=signin_change", nil
|
||||
}
|
||||
|
||||
func (a *App) MigrateIdLDAP(toAttribute string) *model.AppError {
|
||||
if ldapI := a.Ldap(); ldapI != nil {
|
||||
if err := ldapI.MigrateIDAttribute(toAttribute); err != nil {
|
||||
switch err := err.(type) {
|
||||
case *model.AppError:
|
||||
return err
|
||||
default:
|
||||
return model.NewAppError("IdMigrateLDAP", "ent.ldap_id_migrate.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return model.NewAppError("IdMigrateLDAP", "ent.ldap.disabled.app_error", nil, "", http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
@@ -10054,6 +10054,28 @@ func (a *OpenTracingAppLayer) MigrateFilenamesToFileInfos(post *model.Post) []*m
|
||||
return resultVar0
|
||||
}
|
||||
|
||||
func (a *OpenTracingAppLayer) MigrateIdLDAP(toAttribute string) *model.AppError {
|
||||
origCtx := a.ctx
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.MigrateIdLDAP")
|
||||
|
||||
a.ctx = newCtx
|
||||
a.app.Srv().Store.SetContext(newCtx)
|
||||
defer func() {
|
||||
a.app.Srv().Store.SetContext(origCtx)
|
||||
a.ctx = origCtx
|
||||
}()
|
||||
|
||||
defer span.Finish()
|
||||
resultVar0 := a.app.MigrateIdLDAP(toAttribute)
|
||||
|
||||
if resultVar0 != nil {
|
||||
span.LogFields(spanlog.Error(resultVar0))
|
||||
ext.Error.Set(span, true)
|
||||
}
|
||||
|
||||
return resultVar0
|
||||
}
|
||||
|
||||
func (a *OpenTracingAppLayer) MoveChannel(team *model.Team, channel *model.Channel, user *model.User) *model.AppError {
|
||||
origCtx := a.ctx
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.MoveChannel")
|
||||
|
||||
Ссылка в новой задаче
Block a user