Big things, maybe all's better now

This commit is contained in:
AlacrisDevs
2026-02-09 11:36:39 +02:00
parent 38a0c2274d
commit a4baa1ad25
46 changed files with 4906 additions and 427 deletions

View File

@@ -0,0 +1,25 @@
-- Test: simplest possible policies for organizations + org_members
-- Remove is_platform_admin() to isolate the issue
-- Fix organizations SELECT
DROP POLICY IF EXISTS "Members can view their organizations" ON public.organizations;
CREATE POLICY "Members can view their organizations" ON public.organizations
FOR SELECT TO authenticated
USING (
EXISTS (
SELECT 1 FROM public.org_members
WHERE org_id = organizations.id
AND user_id = (select auth.uid())
)
);
-- Fix org_members SELECT - use simplest self-referencing pattern
DROP POLICY IF EXISTS "Members can view org members" ON public.org_members;
CREATE POLICY "Members can view org members" ON public.org_members
FOR SELECT TO authenticated
USING (
org_id IN (
SELECT om.org_id FROM public.org_members om
WHERE om.user_id = (select auth.uid())
)
);