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

Skip to content

Commit 467646d

Browse files
committed
authzquery: fix InsertAgentStat
1 parent 13710c6 commit 467646d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

coderd/authzquery/workspace.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,8 @@ func (q *AuthzQuerier) UpdateWorkspaceAgentConnectionByID(ctx context.Context, a
343343

344344
func (q *AuthzQuerier) InsertAgentStat(ctx context.Context, arg database.InsertAgentStatParams) (database.AgentStat, error) {
345345
// TODO: This is a workspace agent operation. Should users be able to query this?
346-
workspace, err := q.database.GetWorkspaceByAgentID(ctx, arg.ID)
347-
if err != nil {
348-
return database.AgentStat{}, err
349-
}
350-
err = q.authorizeContext(ctx, rbac.ActionUpdate, workspace)
346+
resource := rbac.ResourceWorkspace.WithID(arg.WorkspaceID).WithOwner(arg.UserID.String())
347+
err := q.authorizeContext(ctx, rbac.ActionUpdate, resource)
351348
if err != nil {
352349
return database.AgentStat{}, err
353350
}

0 commit comments

Comments
 (0)