support setting default org role when adding user via grafana.net auth

This commit is contained in:
Dan Cech
2016-09-20 12:36:36 -04:00
parent da95a23080
commit 630a8ed8aa
5 changed files with 23 additions and 14 deletions

View File

@@ -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 {