api4/user: fix-failing-ee-tests (#15372)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
Ibrahim Serdar Acikgoz
2020-09-01 12:25:00 +03:00
committed by GitHub
parent 0da164f70e
commit 26cdbd5dba

View File

@@ -2594,6 +2594,16 @@ func migrateAuthToLDAP(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if c.App.Srv().License() == nil || !*c.App.Srv().License().Features.LDAP {
c.Err = model.NewAppError("api.migrateAuthToLDAP", "api.admin.ldap.not_available.app_error", nil, "", http.StatusNotImplemented)
return
}
// Email auth in Mattermost system is represented by ""
if from == "email" {
from = ""
}
if migrate := c.App.AccountMigration(); migrate != nil {
if err := migrate.MigrateToLdap(from, matchField, force, false); err != nil {
c.Err = model.NewAppError("api.migrateAuthToLdap", "api.migrate_to_saml.error", nil, err.Error(), http.StatusInternalServerError)
@@ -2643,6 +2653,16 @@ func migrateAuthToSaml(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if c.App.Srv().License() == nil || !*c.App.Srv().License().Features.SAML {
c.Err = model.NewAppError("api.migrateAuthToSaml", "api.admin.saml.not_available.app_error", nil, "", http.StatusNotImplemented)
return
}
// Email auth in Mattermost system is represented by ""
if from == "email" {
from = ""
}
if migrate := c.App.AccountMigration(); migrate != nil {
if err := migrate.MigrateToSaml(from, usersMap, auto, false); err != nil {
c.Err = model.NewAppError("api.migrateAuthToSaml", "api.migrate_to_saml.error", nil, err.Error(), http.StatusInternalServerError)