diff --git a/api/http/handler/settings/settings_public.go b/api/http/handler/settings/settings_public.go index 76818743f..921966a3d 100644 --- a/api/http/handler/settings/settings_public.go +++ b/api/http/handler/settings/settings_public.go @@ -95,8 +95,10 @@ func generatePublicSettings(appSettings *portainer.Settings) *publicSettingsResp } } //if LDAP authentication is on, compose the related fields from application settings - if publicSettings.AuthenticationMethod == portainer.AuthenticationLDAP { - publicSettings.TeamSync = len(appSettings.LDAPSettings.GroupSearchSettings) > 0 + if publicSettings.AuthenticationMethod == portainer.AuthenticationLDAP && appSettings.LDAPSettings.GroupSearchSettings != nil { + if len(appSettings.LDAPSettings.GroupSearchSettings) > 0 { + publicSettings.TeamSync = len(appSettings.LDAPSettings.GroupSearchSettings[0].GroupBaseDN) > 0 + } } return publicSettings }