Skip to content

Commit 2c387ce

Browse files
committed
refactor: simplify workspace type assertion
1 parent 1f0e33a commit 2c387ce

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

coderd/workspacebuilds.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,11 @@ func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) {
397397
return true
398398
}
399399
// Special handling for prebuilt workspace deletion
400-
if object.RBACObject().Type == rbac.ResourceWorkspace.Type && action == policy.ActionDelete {
401-
if workspaceObj, ok := object.(database.Workspace); ok && workspaceObj.IsPrebuild() {
400+
if action == policy.ActionDelete {
401+
if workspaceObj, ok := object.(interface {
402+
IsPrebuild() bool
403+
AsPrebuild() rbac.Object
404+
}); ok && workspaceObj.IsPrebuild() {
402405
return api.Authorize(r, action, workspaceObj.AsPrebuild())
403406
}
404407
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy