mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 23:53:10 +08:00
Organization: You can now update the organization user role directly (without removing and readding the organization user). Closes #1899
This commit is contained in:
@ -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")
|
||||
|
||||
|
Reference in New Issue
Block a user