From 1ec295f88ca99e9423ffd91019cecf802ae3dc77 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 6 Feb 2018 17:25:49 -0600 Subject: add App.License, remove utils.IsLicensed / utils.License calls (#8203) --- app/ldap.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'app/ldap.go') diff --git a/app/ldap.go b/app/ldap.go index 49f3d034a..179529c52 100644 --- a/app/ldap.go +++ b/app/ldap.go @@ -14,7 +14,7 @@ import ( func (a *App) SyncLdap() { a.Go(func() { - if utils.IsLicensed() && *utils.License().Features.LDAP && *a.Config().LdapSettings.EnableSync { + if license := a.License(); license != nil && *license.Features.LDAP && *a.Config().LdapSettings.EnableSync { if ldapI := a.Ldap; ldapI != nil { ldapI.StartSynchronizeJob(false) } else { @@ -25,7 +25,8 @@ func (a *App) SyncLdap() { } func (a *App) TestLdap() *model.AppError { - if ldapI := a.Ldap; ldapI != nil && utils.IsLicensed() && *utils.License().Features.LDAP && (*a.Config().LdapSettings.Enable || *a.Config().LdapSettings.EnableSync) { + license := a.License() + if ldapI := a.Ldap; ldapI != nil && license != nil && *license.Features.LDAP && (*a.Config().LdapSettings.Enable || *a.Config().LdapSettings.EnableSync) { if err := ldapI.RunTest(); err != nil { err.StatusCode = 500 return err @@ -39,7 +40,7 @@ func (a *App) TestLdap() *model.AppError { } func (a *App) SwitchEmailToLdap(email, password, code, ldapId, ldapPassword string) (string, *model.AppError) { - if utils.IsLicensed() && !*a.Config().ServiceSettings.ExperimentalEnableAuthenticationTransfer { + if a.License() != nil && !*a.Config().ServiceSettings.ExperimentalEnableAuthenticationTransfer { return "", model.NewAppError("emailToLdap", "api.user.email_to_ldap.not_available.app_error", nil, "", http.StatusForbidden) } @@ -75,7 +76,7 @@ func (a *App) SwitchEmailToLdap(email, password, code, ldapId, ldapPassword stri } func (a *App) SwitchLdapToEmail(ldapPassword, code, email, newPassword string) (string, *model.AppError) { - if utils.IsLicensed() && !*a.Config().ServiceSettings.ExperimentalEnableAuthenticationTransfer { + if a.License() != nil && !*a.Config().ServiceSettings.ExperimentalEnableAuthenticationTransfer { return "", model.NewAppError("ldapToEmail", "api.user.ldap_to_email.not_available.app_error", nil, "", http.StatusForbidden) } -- cgit v1.2.3-1-g7c22