summaryrefslogtreecommitdiffstats
path: root/app/ldap.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-09-19 18:31:35 -0500
committerGitHub <noreply@github.com>2017-09-19 18:31:35 -0500
commitac74066f0e4f3d62f2d4645c3fa34b88c13958d1 (patch)
tree9e1cb80eae1b4a2e9dcc2272744c4a9db1b4b804 /app/ldap.go
parent7e4ff6adcccc4cc5a8fb8cfa853417ec52bf78f4 (diff)
downloadchat-ac74066f0e4f3d62f2d4645c3fa34b88c13958d1.tar.gz
chat-ac74066f0e4f3d62f2d4645c3fa34b88c13958d1.tar.bz2
chat-ac74066f0e4f3d62f2d4645c3fa34b88c13958d1.zip
remove einterface gets (#7455)
Diffstat (limited to 'app/ldap.go')
-rw-r--r--app/ldap.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/app/ldap.go b/app/ldap.go
index b448850dd..279ea3708 100644
--- a/app/ldap.go
+++ b/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
}