Files
root-org/supabase/migrations/057_invite_org_rls.sql
AlacrisDevs 71bf7b9057 YEs
2026-02-09 12:00:40 +02:00

13 lines
464 B
SQL

-- Allow anyone to read organization basic info when referenced by a valid invite.
-- This is needed so the invite page can display the org name to non-members.
CREATE POLICY "Anyone can view org via valid invite" ON public.organizations
FOR SELECT
USING (
EXISTS (
SELECT 1 FROM public.org_invites oi
WHERE oi.org_id = organizations.id
AND oi.accepted_at IS NULL
AND (oi.expires_at IS NULL OR oi.expires_at > now())
)
);