mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 05:42:28 +08:00
Move SignedInUser to user service and RoleType and Roles to org (#53445)
* Move SignedInUser to user service and RoleType and Roles to org * Use go naming convention for roles * Fix some imports and leftovers * Fix ldap debug test * Fix lint * Fix lint 2 * Fix lint 3 * Fix type and not needed conversion * Clean up messages in api tests * Clean up api tests 2
This commit is contained in:
@ -14,6 +14,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/ldap"
|
||||
"github.com/grafana/grafana/pkg/services/login"
|
||||
"github.com/grafana/grafana/pkg/services/multildap"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
@ -39,10 +40,10 @@ type LDAPAttribute struct {
|
||||
|
||||
// RoleDTO is a serializer for mapped roles from LDAP
|
||||
type LDAPRoleDTO struct {
|
||||
OrgId int64 `json:"orgId"`
|
||||
OrgName string `json:"orgName"`
|
||||
OrgRole models.RoleType `json:"orgRole"`
|
||||
GroupDN string `json:"groupDN"`
|
||||
OrgId int64 `json:"orgId"`
|
||||
OrgName string `json:"orgName"`
|
||||
OrgRole org.RoleType `json:"orgRole"`
|
||||
GroupDN string `json:"groupDN"`
|
||||
}
|
||||
|
||||
// LDAPUserDTO is a serializer for users mapped from LDAP
|
||||
@ -333,7 +334,7 @@ func (hs *HTTPServer) GetUserFromLDAP(c *models.ReqContext) response.Response {
|
||||
}
|
||||
|
||||
orgIDs := []int64{} // IDs of the orgs the user is a member of
|
||||
orgRolesMap := map[int64]models.RoleType{}
|
||||
orgRolesMap := map[int64]org.RoleType{}
|
||||
for _, group := range serverConfig.Groups {
|
||||
// only use the first match for each org
|
||||
if orgRolesMap[group.OrgId] != "" {
|
||||
|
Reference in New Issue
Block a user