mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
feat: expose Everyone group through UI (#9117)
- Allows setting quota allowances on the 'Everyone' group.
This commit is contained in:
@ -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
|
||||
|
@ -26,9 +26,7 @@ SELECT
|
||||
FROM
|
||||
groups
|
||||
WHERE
|
||||
organization_id = $1
|
||||
AND
|
||||
id != $1;
|
||||
organization_id = $1;
|
||||
|
||||
-- name: InsertGroup :one
|
||||
INSERT INTO groups (
|
||||
|
@ -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 (
|
||||
|
Reference in New Issue
Block a user