Commit e1e7fbf8 by Torkel Ödegaard

Merge branch 'master' of github.com:grafana/grafana

parents c739428c 5eceabf8
...@@ -219,7 +219,8 @@ func (a *ldapAuther) syncOrgRoles(user *m.User, ldapUser *ldapUserInfo) error { ...@@ -219,7 +219,8 @@ func (a *ldapAuther) syncOrgRoles(user *m.User, ldapUser *ldapUserInfo) error {
// add role // add role
cmd := m.AddOrgUserCommand{UserId: user.Id, Role: group.OrgRole, OrgId: group.OrgId} cmd := m.AddOrgUserCommand{UserId: user.Id, Role: group.OrgRole, OrgId: group.OrgId}
if err := bus.Dispatch(&cmd); err != nil { err := bus.Dispatch(&cmd)
if err != nil && err != m.ErrOrgNotFound {
return err return err
} }
......
...@@ -26,6 +26,12 @@ func AddOrgUser(cmd *m.AddOrgUserCommand) error { ...@@ -26,6 +26,12 @@ func AddOrgUser(cmd *m.AddOrgUserCommand) error {
return m.ErrOrgUserAlreadyAdded return m.ErrOrgUserAlreadyAdded
} }
if res, err := sess.Query("SELECT 1 from org WHERE id=?", cmd.OrgId); err != nil {
return err
} else if len(res) != 1 {
return m.ErrOrgNotFound
}
entity := m.OrgUser{ entity := m.OrgUser{
OrgId: cmd.OrgId, OrgId: cmd.OrgId,
UserId: cmd.UserId, UserId: cmd.UserId,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment