mirror of
https://github.com/coder/coder.git
synced 2025-07-21 01:28:49 +00:00
fix: ensure agent token is from latest build in middleware (#12443)
This commit is contained in:
@ -1880,12 +1880,12 @@ func (q *querier) GetUsersByIDs(ctx context.Context, ids []uuid.UUID) ([]databas
|
||||
return q.db.GetUsersByIDs(ctx, ids)
|
||||
}
|
||||
|
||||
func (q *querier) GetWorkspaceAgentAndOwnerByAuthToken(ctx context.Context, authToken uuid.UUID) (database.GetWorkspaceAgentAndOwnerByAuthTokenRow, error) {
|
||||
func (q *querier) GetWorkspaceAgentAndLatestBuildByAuthToken(ctx context.Context, authToken uuid.UUID) (database.GetWorkspaceAgentAndLatestBuildByAuthTokenRow, error) {
|
||||
// This is a system function
|
||||
if err := q.authorizeContext(ctx, rbac.ActionRead, rbac.ResourceSystem); err != nil {
|
||||
return database.GetWorkspaceAgentAndOwnerByAuthTokenRow{}, err
|
||||
return database.GetWorkspaceAgentAndLatestBuildByAuthTokenRow{}, err
|
||||
}
|
||||
return q.db.GetWorkspaceAgentAndOwnerByAuthToken(ctx, authToken)
|
||||
return q.db.GetWorkspaceAgentAndLatestBuildByAuthToken(ctx, authToken)
|
||||
}
|
||||
|
||||
func (q *querier) GetWorkspaceAgentByID(ctx context.Context, id uuid.UUID) (database.WorkspaceAgent, error) {
|
||||
|
Reference in New Issue
Block a user