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

Skip to content

Commit 1979cde

Browse files
committed
feat: Implement view for workspace builds to include rbac info
Removes the need to fetch the workspace to run an rbac check.
1 parent d30da81 commit 1979cde

8 files changed

+120
-52
lines changed

coderd/database/dump.sql

Lines changed: 33 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP VIEW workspace_builds_rbac;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
BEGIN;
2+
-- workspace_builds_rbac includes the linked workspace information
3+
-- required to perform RBAC checks on workspace builds without needing
4+
-- to fetch the workspace.
5+
CREATE VIEW workspace_builds_rbac AS
6+
SELECT
7+
workspace_builds.*,
8+
workspaces.organization_id AS organization_id,
9+
workspaces.owner_id AS workspace_owner_id
10+
FROM
11+
workspace_builds
12+
INNER JOIN
13+
workspaces ON workspace_builds.workspace_id = workspaces.id;
14+
COMMIT;

coderd/database/models.go

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/querier.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 37 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)