mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: scope workspace quotas to organizations (#14352)
* chore: scope workspace quotas to organizations Quotas are now a function of (user_id, organization_id). They are still sourced from groups. Deprecate the old api endpoint.
This commit is contained in:
@@ -5,7 +5,10 @@ FROM
|
||||
(
|
||||
-- Select all groups this user is a member of. This will also include
|
||||
-- the "Everyone" group for organizations the user is a member of.
|
||||
SELECT * FROM group_members_expanded WHERE @user_id = user_id
|
||||
SELECT * FROM group_members_expanded
|
||||
WHERE
|
||||
@user_id = user_id AND
|
||||
@organization_id = group_members_expanded.organization_id
|
||||
) AS members
|
||||
INNER JOIN groups ON
|
||||
members.group_id = groups.id
|
||||
@@ -30,4 +33,8 @@ FROM
|
||||
workspaces
|
||||
JOIN latest_builds ON
|
||||
latest_builds.workspace_id = workspaces.id
|
||||
WHERE NOT deleted AND workspaces.owner_id = $1;
|
||||
WHERE NOT
|
||||
deleted AND
|
||||
workspaces.owner_id = @owner_id AND
|
||||
workspaces.organization_id = @organization_id
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user