feat: assign users to groups returned by OIDC provider (#5965)

This commit is contained in:
Colin Adler
2023-02-02 13:53:48 -06:00
committed by GitHub
parent 026b1cd2a4
commit 496138b086
11 changed files with 477 additions and 133 deletions

View File

@ -20,22 +20,6 @@ AND
LIMIT
1;
-- name: GetGroupMembers :many
SELECT
users.*
FROM
users
JOIN
group_members
ON
users.id = group_members.user_id
WHERE
group_members.group_id = $1
AND
users.status = 'active'
AND
users.deleted = 'false';
-- name: GetGroupsByOrganizationID :many
SELECT
*
@ -55,7 +39,7 @@ INSERT INTO groups (
quota_allowance
)
VALUES
( $1, $2, $3, $4, $5) RETURNING *;
($1, $2, $3, $4, $5) RETURNING *;
-- We use the organization_id as the id
-- for simplicity since all users is
@ -67,7 +51,7 @@ INSERT INTO groups (
organization_id
)
VALUES
( sqlc.arg(organization_id), 'Everyone', sqlc.arg(organization_id)) RETURNING *;
(sqlc.arg(organization_id), 'Everyone', sqlc.arg(organization_id)) RETURNING *;
-- name: UpdateGroupByID :one
UPDATE
@ -80,20 +64,6 @@ WHERE
id = $4
RETURNING *;
-- name: InsertGroupMember :exec
INSERT INTO group_members (
user_id,
group_id
)
VALUES ($1, $2);
-- name: DeleteGroupMemberFromGroup :exec
DELETE FROM
group_members
WHERE
user_id = $1 AND
group_id = $2;
-- name: DeleteGroupByID :exec
DELETE FROM
groups