Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 00955e0

Browse files
committed
Add AsSystem
1 parent 51a2dae commit 00955e0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

coderd/workspaceapps.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,10 @@ func (api *API) handleWorkspaceAppLogout(rw http.ResponseWriter, r *http.Request
410410
// error while looking it up, an HTML error page is returned and false is
411411
// returned so the caller can return early.
412412
func (api *API) lookupWorkspaceApp(rw http.ResponseWriter, r *http.Request, agentID uuid.UUID, appSlug string) (database.WorkspaceApp, bool) {
413-
app, err := api.Database.GetWorkspaceAppByAgentIDAndSlug(r.Context(), database.GetWorkspaceAppByAgentIDAndSlugParams{
413+
// dbauthz.AsSystem is allowed here as the app authz is checked later.
414+
// The app authz is determined by the sharing level.
415+
//nolint:gocritic
416+
app, err := api.Database.GetWorkspaceAppByAgentIDAndSlug(dbauthz.AsSystem(r.Context()), database.GetWorkspaceAppByAgentIDAndSlugParams{
414417
AgentID: agentID,
415418
Slug: appSlug,
416419
})

0 commit comments

Comments
 (0)