remove einterface gets (#7455)
Этот коммит содержится в:
15
app/ldap.go
15
app/ldap.go
@@ -7,15 +7,14 @@ import (
|
||||
"net/http"
|
||||
|
||||
l4g "github.com/alecthomas/log4go"
|
||||
"github.com/mattermost/mattermost-server/einterfaces"
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/utils"
|
||||
)
|
||||
|
||||
func SyncLdap() {
|
||||
func (a *App) SyncLdap() {
|
||||
go func() {
|
||||
if utils.IsLicensed() && *utils.License().Features.LDAP && *utils.Cfg.LdapSettings.Enable {
|
||||
if ldapI := einterfaces.GetLdapInterface(); ldapI != nil {
|
||||
if ldapI := a.Ldap; ldapI != nil {
|
||||
ldapI.SyncNow()
|
||||
} else {
|
||||
l4g.Error("%v", model.NewAppError("SyncLdap", "ent.ldap.disabled.app_error", nil, "", http.StatusNotImplemented).Error())
|
||||
@@ -24,8 +23,8 @@ func SyncLdap() {
|
||||
}()
|
||||
}
|
||||
|
||||
func TestLdap() *model.AppError {
|
||||
if ldapI := einterfaces.GetLdapInterface(); ldapI != nil && utils.IsLicensed() && *utils.License().Features.LDAP && *utils.Cfg.LdapSettings.Enable {
|
||||
func (a *App) TestLdap() *model.AppError {
|
||||
if ldapI := a.Ldap; ldapI != nil && utils.IsLicensed() && *utils.License().Features.LDAP && *utils.Cfg.LdapSettings.Enable {
|
||||
if err := ldapI.RunTest(); err != nil {
|
||||
err.StatusCode = 500
|
||||
return err
|
||||
@@ -52,7 +51,7 @@ func (a *App) SwitchEmailToLdap(email, password, code, ldapId, ldapPassword stri
|
||||
return "", err
|
||||
}
|
||||
|
||||
ldapInterface := einterfaces.GetLdapInterface()
|
||||
ldapInterface := a.Ldap
|
||||
if ldapInterface == nil {
|
||||
return "", model.NewAppError("SwitchEmailToLdap", "api.user.email_to_ldap.not_available.app_error", nil, "", http.StatusNotImplemented)
|
||||
}
|
||||
@@ -80,7 +79,7 @@ func (a *App) SwitchLdapToEmail(ldapPassword, code, email, newPassword string) (
|
||||
return "", model.NewAppError("SwitchLdapToEmail", "api.user.ldap_to_email.not_ldap_account.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
ldapInterface := einterfaces.GetLdapInterface()
|
||||
ldapInterface := a.Ldap
|
||||
if ldapInterface == nil || user.AuthData == nil {
|
||||
return "", model.NewAppError("SwitchLdapToEmail", "api.user.ldap_to_email.not_available.app_error", nil, "", http.StatusNotImplemented)
|
||||
}
|
||||
@@ -89,7 +88,7 @@ func (a *App) SwitchLdapToEmail(ldapPassword, code, email, newPassword string) (
|
||||
return "", err
|
||||
}
|
||||
|
||||
if err := CheckUserMfa(user, code); err != nil {
|
||||
if err := a.CheckUserMfa(user, code); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user