From 836f5c1f4a2f5a03b91121a2e80f23369f711e13 Mon Sep 17 00:00:00 2001 From: Gabriel MABILLE Date: Thu, 21 Apr 2022 16:38:55 +0200 Subject: [PATCH] LDAP: Fix Debug mapping roles and groups (#48059) Co-authored-by: Jguer Co-authored-by: Jguer --- pkg/api/ldap_debug.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/api/ldap_debug.go b/pkg/api/ldap_debug.go index 97b1e5142fe..c7a978e0234 100644 --- a/pkg/api/ldap_debug.go +++ b/pkg/api/ldap_debug.go @@ -6,6 +6,7 @@ import ( "fmt" "net/http" "strconv" + "strings" "github.com/grafana/grafana/pkg/api/response" "github.com/grafana/grafana/pkg/infra/log" @@ -274,7 +275,7 @@ func (hs *HTTPServer) GetUserFromLDAP(c *models.ReqContext) response.Response { // over another. for _, configGroup := range serverConfig.Groups { for _, userGroup := range user.Groups { - if configGroup.GroupDN == userGroup { + if strings.EqualFold(configGroup.GroupDN, userGroup) { r := &LDAPRoleDTO{GroupDN: configGroup.GroupDN, OrgId: configGroup.OrgId, OrgRole: configGroup.OrgRole} orgRoles = append(orgRoles, *r) break @@ -289,7 +290,7 @@ func (hs *HTTPServer) GetUserFromLDAP(c *models.ReqContext) response.Response { var matched bool for _, orgRole := range orgRoles { - if orgRole.GroupDN == userGroup { // we already matched it + if strings.EqualFold(orgRole.GroupDN, userGroup) { // we already matched it matched = true break }