mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
OAuth: Enforce auto_assign_org_id setting when role mapping enabled using Generic OAuth (#22268)
* OAuth: Make use of auto_assign_org_id setting
This commit is contained in:
@@ -186,7 +186,13 @@ func (hs *HTTPServer) OAuthLogin(ctx *m.ReqContext) {
|
||||
if userInfo.Role != "" {
|
||||
rt := m.RoleType(userInfo.Role)
|
||||
if rt.IsValid() {
|
||||
extUser.OrgRoles[1] = rt
|
||||
var orgID int64
|
||||
if setting.AutoAssignOrg && setting.AutoAssignOrgId > 0 {
|
||||
orgID = int64(setting.AutoAssignOrgId)
|
||||
} else {
|
||||
orgID = int64(1)
|
||||
}
|
||||
extUser.OrgRoles[orgID] = rt
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user