mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add shared_with_group: and shared_with_user: filters to /workspaces endpoint (#19875)
Adds shared_with_user and shared_with_group filters to the /workspaces endpoint. - `shared_with_user`: filters workspaces shared with a specific user. Accepts a user UUID or username. - `shared_with_group`: filters workspaces shared with a specific group. Accepts: - a group UUID, or - `<organization name>/<group name>`, or - `<group name>` (resolved in the default organization). Closes [coder/internal#1004](https://github.com/coder/internal/issues/1004)
This commit is contained in:
@@ -384,7 +384,18 @@ WHERE
|
||||
(workspaces.user_acl != '{}'::jsonb OR workspaces.group_acl != '{}'::jsonb) = sqlc.narg('shared') :: boolean
|
||||
ELSE true
|
||||
END
|
||||
|
||||
-- Filter by shared_with_user_id
|
||||
AND CASE
|
||||
WHEN @shared_with_user_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN
|
||||
workspaces.user_acl ? (@shared_with_user_id :: uuid) :: text
|
||||
ELSE true
|
||||
END
|
||||
-- Filter by shared_with_group_id
|
||||
AND CASE
|
||||
WHEN @shared_with_group_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN
|
||||
workspaces.group_acl ? (@shared_with_group_id :: uuid) :: text
|
||||
ELSE true
|
||||
END
|
||||
-- Authorize Filter clause will be injected below in GetAuthorizedWorkspaces
|
||||
-- @authorize_filter
|
||||
), filtered_workspaces_order AS (
|
||||
|
||||
Reference in New Issue
Block a user