Organization: You can now update the organization user role directly (without removing and readding the organization user). Closes #1899

This commit is contained in:
Torkel Ödegaard
2015-05-01 09:48:07 +02:00
parent b48b11e902
commit e771d8e944
9 changed files with 74 additions and 2 deletions

View File

@ -48,6 +48,23 @@ func GetOrgUsers(c *middleware.Context) {
c.JSON(200, query.Result)
}
func UpdateOrgUser(c *middleware.Context, cmd m.UpdateOrgUserCommand) {
if !cmd.Role.IsValid() {
c.JsonApiErr(400, "Invalid role specified", nil)
return
}
cmd.UserId = c.ParamsInt64(":id")
cmd.OrgId = c.OrgId
if err := bus.Dispatch(&cmd); err != nil {
c.JsonApiErr(500, "Failed update org user", err)
return
}
c.JsonOK("Organization user updated")
}
func RemoveOrgUser(c *middleware.Context) {
userId := c.ParamsInt64(":id")