mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
support setting default org role when adding user via grafana.net auth
This commit is contained in:
@@ -128,7 +128,11 @@ func CreateUser(cmd *m.CreateUserCommand) error {
|
||||
}
|
||||
|
||||
if setting.AutoAssignOrg && !user.IsAdmin {
|
||||
orgUser.Role = m.RoleType(setting.AutoAssignOrgRole)
|
||||
if len(cmd.DefaultOrgRole) > 0 {
|
||||
orgUser.Role = m.RoleType(cmd.DefaultOrgRole)
|
||||
} else {
|
||||
orgUser.Role = m.RoleType(setting.AutoAssignOrgRole)
|
||||
}
|
||||
}
|
||||
|
||||
if _, err = sess.Insert(&orgUser); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user