Skip to content

Commit 41502c1

Browse files
committed
Also modify my_accounts
1 parent 495d241 commit 41502c1

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

packages/database/supabase/migrations/20260421141140_select_platform_account_of_partial_space.sql

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,22 @@ DROP POLICY IF EXISTS agent_identifier_select_policy ON public."AgentIdentifier"
2020
DROP function public.account_in_shared_space(p_account_id BIGINT);
2121

2222
CREATE POLICY agent_identifier_select_policy ON public."AgentIdentifier" FOR SELECT USING (public.account_in_shared_space(account_id));
23+
24+
CREATE OR REPLACE VIEW public.my_accounts AS
25+
SELECT
26+
id,
27+
name,
28+
platform,
29+
account_local_id,
30+
write_permission,
31+
active,
32+
agent_type,
33+
metadata,
34+
dg_account
35+
FROM public."PlatformAccount"
36+
WHERE id IN (
37+
SELECT "LocalAccess".account_id FROM public."LocalAccess"
38+
JOIN public."SpaceAccess" USING (space_id)
39+
JOIN public.my_user_accounts() ON (account_uid = my_user_accounts)
40+
WHERE permissions >= 'partial'
41+
);

packages/database/supabase/schemas/account.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ WHERE id IN (
453453
SELECT "LocalAccess".account_id FROM public."LocalAccess"
454454
JOIN public."SpaceAccess" USING (space_id)
455455
JOIN public.my_user_accounts() ON (account_uid = my_user_accounts)
456-
WHERE permissions >= 'reader'
456+
WHERE permissions >= 'partial'
457457
);
458458

459459
DROP POLICY IF EXISTS platform_account_policy ON public."PlatformAccount";

0 commit comments

Comments
 (0)