From acb37e29abd0748be3789855915247c43a3fcdae Mon Sep 17 00:00:00 2001 From: Stavros Date: Sat, 17 Jan 2026 19:33:51 +0200 Subject: [PATCH] fix: review feedback --- internal/service/auth_service.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/service/auth_service.go b/internal/service/auth_service.go index a6391cd..0083993 100644 --- a/internal/service/auth_service.go +++ b/internal/service/auth_service.go @@ -141,9 +141,13 @@ func (auth *AuthService) GetLocalUser(username string) config.User { } func (auth *AuthService) GetLdapUser(userDN string) (config.LdapUser, error) { - auth.ldapGroupsMutex.Lock() + if auth.ldap == nil { + return config.LdapUser{}, errors.New("LDAP service not initialized") + } + + auth.ldapGroupsMutex.RLock() entry, exists := auth.ldapGroupsCache[userDN] - auth.ldapGroupsMutex.Unlock() + auth.ldapGroupsMutex.RUnlock() if exists && time.Now().Before(entry.Expires) { return config.LdapUser{