Skip to content

Commit acb37e2

Browse files
committed
fix: review feedback
1 parent 5093200 commit acb37e2

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

internal/service/auth_service.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,13 @@ func (auth *AuthService) GetLocalUser(username string) config.User {
141141
}
142142

143143
func (auth *AuthService) GetLdapUser(userDN string) (config.LdapUser, error) {
144-
auth.ldapGroupsMutex.Lock()
144+
if auth.ldap == nil {
145+
return config.LdapUser{}, errors.New("LDAP service not initialized")
146+
}
147+
148+
auth.ldapGroupsMutex.RLock()
145149
entry, exists := auth.ldapGroupsCache[userDN]
146-
auth.ldapGroupsMutex.Unlock()
150+
auth.ldapGroupsMutex.RUnlock()
147151

148152
if exists && time.Now().Before(entry.Expires) {
149153
return config.LdapUser{

0 commit comments

Comments
 (0)