mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add filtering by service account (#23468)
You can now filter by/out service accounts using `service_account:true/false` or using the filter dropdown.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
SELECT
|
||||
sqlc.embed(organization_members),
|
||||
users.username, users.avatar_url, users.name, users.email, users.rbac_roles as "global_roles",
|
||||
users.last_seen_at, users.status, users.login_type,
|
||||
users.last_seen_at, users.status, users.login_type, users.is_service_account,
|
||||
users.created_at as user_created_at, users.updated_at as user_updated_at
|
||||
FROM
|
||||
organization_members
|
||||
@@ -85,7 +85,7 @@ RETURNING *;
|
||||
SELECT
|
||||
sqlc.embed(organization_members),
|
||||
users.username, users.avatar_url, users.name, users.email, users.rbac_roles as "global_roles",
|
||||
users.last_seen_at, users.status, users.login_type,
|
||||
users.last_seen_at, users.status, users.login_type, users.is_service_account,
|
||||
users.created_at as user_created_at, users.updated_at as user_updated_at,
|
||||
COUNT(*) OVER() AS count
|
||||
FROM
|
||||
@@ -190,6 +190,12 @@ WHERE
|
||||
users.login_type = ANY(@login_type :: login_type[])
|
||||
ELSE true
|
||||
END
|
||||
-- Filter by service account.
|
||||
AND CASE
|
||||
WHEN sqlc.narg('is_service_account') :: boolean IS NOT NULL THEN
|
||||
users.is_service_account = sqlc.narg('is_service_account') :: boolean
|
||||
ELSE true
|
||||
END
|
||||
-- End of filters
|
||||
ORDER BY
|
||||
-- Deterministic and consistent ordering of all users. This is to ensure consistent pagination.
|
||||
|
||||
Reference in New Issue
Block a user