Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
If cannot read user, return 404
  • Loading branch information
Emyrk committed Jun 13, 2022
commit 93c04dbeee28122a0c52e40db2bee89cf3b2003a
5 changes: 5 additions & 0 deletions coderd/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,11 @@ func (api *API) putUserRoles(rw http.ResponseWriter, r *http.Request) {
return
}

if !api.Authorize(r, rbac.ActionRead, rbac.ResourceUser.WithID(user.ID.String())) {
httpapi.ResourceNotFound(rw)
return
}

// The member role is always implied.
impliedTypes := append(params.Roles, rbac.RoleMember())
added, removed := rbac.ChangeRoleSet(roles.Roles, impliedTypes)
Expand Down