Skip to content

Commit cd2fda7

Browse files
committed
Update comment
1 parent 4b6c9b0 commit cd2fda7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

coderd/coderd.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func New(options *Options) (http.Handler, func()) {
240240
)
241241
r.Group(func(r chi.Router) {
242242
// Site wide, all users
243-
r.Use(httpmw.WithRBACObject(rbac.ResourceUser.All()))
243+
r.Use(httpmw.WithRBACObject(rbac.ResourceUser))
244244
r.Post("/", authorize(api.postUser, rbac.ActionCreate))
245245
r.Get("/", authorize(api.users, rbac.ActionRead))
246246
})

coderd/users.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,9 @@ func (api *api) putUserRoles(rw http.ResponseWriter, r *http.Request) {
399399
}
400400

401401
for _, roleName := range params.Roles {
402-
// If the user already has the role, we don't need to check the permission.
402+
// If the user already has the role assigned, we don't need to check the permission
403+
// to reassign it. Only run permission checks on the difference in the set of
404+
// roles.
403405
if _, ok := has[roleName]; ok {
404406
delete(has, roleName)
405407
continue

0 commit comments

Comments
 (0)