feat: expose Everyone group through UI (#9117)

- Allows setting quota allowances on the 'Everyone' group.
This commit is contained in:
Jon Ayers
2023-08-17 13:25:16 -05:00
committed by GitHub
parent 8910f05172
commit 2f6687a475
23 changed files with 458 additions and 80 deletions

View File

@ -3,12 +3,23 @@ SELECT
users.*
FROM
users
JOIN
-- If the group is a user made group, then we need to check the group_members table.
LEFT JOIN
group_members
ON
users.id = group_members.user_id
group_members.user_id = users.id AND
group_members.group_id = @group_id
-- If it is the "Everyone" group, then we need to check the organization_members table.
LEFT JOIN
organization_members
ON
organization_members.user_id = users.id AND
organization_members.organization_id = @group_id
WHERE
group_members.group_id = $1
-- In either case, the group_id will only match an org or a group.
(group_members.group_id = @group_id
OR
organization_members.organization_id = @group_id)
AND
users.status = 'active'
AND

View File

@ -26,9 +26,7 @@ SELECT
FROM
groups
WHERE
organization_id = $1
AND
id != $1;
organization_id = $1;
-- name: InsertGroup :one
INSERT INTO groups (

View File

@ -2,11 +2,13 @@
SELECT
coalesce(SUM(quota_allowance), 0)::BIGINT
FROM
group_members gm
JOIN groups g ON
groups g
LEFT JOIN group_members gm ON
g.id = gm.group_id
WHERE
user_id = $1;
user_id = $1
OR
g.id = g.organization_id;
-- name: GetQuotaConsumedForUser :one
WITH latest_builds AS (