Skip to content

Commit 7ad069e

Browse files
committed
Drop update User auth check from assign roles
1 parent 1047391 commit 7ad069e

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

coderd/coderd_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ func TestAuthorizeAllEndpoints(t *testing.T) {
143143
AssertObject: rbac.ResourceWorkspace.InOrg(organization.ID).WithID(workspace.ID.String()).WithOwner(workspace.OwnerID.String()),
144144
},
145145
"GET:/api/v2/organizations/{organization}/workspaces": {StatusCode: http.StatusOK, AssertObject: rbac.ResourceWorkspace},
146+
147+
// These endpoints need payloads to get to the auth part.
148+
"PUT:/api/v2/users/{user}/roles": {StatusCode: http.StatusBadRequest, NoAuthorize: true},
146149
}
147150

148151
c, _ := srv.Config.Handler.(*chi.Mux)

coderd/users.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,6 @@ func (api *api) putUserRoles(rw http.ResponseWriter, r *http.Request) {
430430
user := httpmw.UserParam(r)
431431
roles := httpmw.UserRoles(r)
432432

433-
if !api.Authorize(rw, r, rbac.ActionUpdate, rbac.ResourceUser.WithOwner(user.ID.String())) {
434-
return
435-
}
436-
437433
var params codersdk.UpdateRoles
438434
if !httpapi.Read(rw, r, &params) {
439435
return

0 commit comments

Comments
 (0)