mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
LDAP: Fix Debug mapping roles and groups (#48059)
Co-authored-by: Jguer <joao.guerreiro@grafana.com> Co-authored-by: Jguer <joao.guerreiro@grafana.com>
This commit is contained in:
parent
412be1f1cf
commit
836f5c1f4a
@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/api/response"
|
"github.com/grafana/grafana/pkg/api/response"
|
||||||
"github.com/grafana/grafana/pkg/infra/log"
|
"github.com/grafana/grafana/pkg/infra/log"
|
||||||
@ -274,7 +275,7 @@ func (hs *HTTPServer) GetUserFromLDAP(c *models.ReqContext) response.Response {
|
|||||||
// over another.
|
// over another.
|
||||||
for _, configGroup := range serverConfig.Groups {
|
for _, configGroup := range serverConfig.Groups {
|
||||||
for _, userGroup := range user.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}
|
r := &LDAPRoleDTO{GroupDN: configGroup.GroupDN, OrgId: configGroup.OrgId, OrgRole: configGroup.OrgRole}
|
||||||
orgRoles = append(orgRoles, *r)
|
orgRoles = append(orgRoles, *r)
|
||||||
break
|
break
|
||||||
@ -289,7 +290,7 @@ func (hs *HTTPServer) GetUserFromLDAP(c *models.ReqContext) response.Response {
|
|||||||
var matched bool
|
var matched bool
|
||||||
|
|
||||||
for _, orgRole := range orgRoles {
|
for _, orgRole := range orgRoles {
|
||||||
if orgRole.GroupDN == userGroup { // we already matched it
|
if strings.EqualFold(orgRole.GroupDN, userGroup) { // we already matched it
|
||||||
matched = true
|
matched = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user