From a0eb22bf8afd1ffd21638900d934b76d6d6bdf9e Mon Sep 17 00:00:00 2001 From: Colton Shaw <46071821+coltoneshaw@users.noreply.github.com> Date: Mon, 13 Feb 2023 12:29:06 -0500 Subject: [PATCH] MM-50443 - LdapSettings.SyncEnabled error message (#22314) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added ldap disabled message * Changed style per suggestions * Remove blank line Co-authored-by: Alejandro García Montoro --------- Co-authored-by: Alejandro García Montoro --- app/ldap.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/ldap.go b/app/ldap.go index 60b09928cb..3ce803b8d9 100644 --- a/app/ldap.go +++ b/app/ldap.go @@ -19,12 +19,18 @@ import ( func (a *App) SyncLdap(includeRemovedMembers bool) { a.Srv().Go(func() { - if license := a.Srv().License(); license != nil && *license.Features.LDAP && *a.Config().LdapSettings.EnableSync { - if ldapI := a.Ldap(); ldapI != nil { - ldapI.StartSynchronizeJob(false, includeRemovedMembers) - } else { - mlog.Error("Not executing ldap sync because ldap is not available") + if license := a.Srv().License(); license != nil && *license.Features.LDAP { + if !*a.Config().LdapSettings.EnableSync { + mlog.Error("LdapSettings.EnableSync is set to false. Skipping LDAP sync.") + return } + + ldapI := a.Ldap() + if ldapI == nil { + mlog.Error("Not executing ldap sync because ldap is not available") + return + } + ldapI.StartSynchronizeJob(false, includeRemovedMembers) } }) }