From 32eb4579dae30be60dd396453366f9744190fc99 Mon Sep 17 00:00:00 2001 From: Zhou You Date: Sun, 23 Mar 2025 13:47:02 +0800 Subject: [PATCH] feat: handle multiple attributes (#3052) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enhance LDAP user group retrieval to handle multiple attributes Signed-off-by: 周游 --- pkg/api/ldap.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/api/ldap.go b/pkg/api/ldap.go index ebd9d430..9eb1e2d6 100644 --- a/pkg/api/ldap.go +++ b/pkg/api/ldap.go @@ -223,8 +223,9 @@ func (lc *LDAPClient) Authenticate(username, password string) (bool, map[string] var userGroups []string if lc.UserGroupAttribute != "" && len(search.Entries[0].Attributes) > 0 { - userAttributes := search.Entries[0].Attributes[0] - userGroups = userAttributes.Values + for _, attr := range search.Entries[0].Attributes { + userGroups = append(userGroups, attr.Values...) + } } user := map[string]string{}