erp-cicd/my-access-hub-main/supabase/migrations/20250809182902_b8764496-8170-4ce6-8c47-7df2b80dc0fc.sql
Ali 20e95c2fb6
Some checks failed
Build & Deploy Frontend / build-push-deploy (push) Failing after 15s
pushing all
2025-08-30 11:51:11 +05:30

11 lines
444 B
SQL

-- Fix the RLS policy for viewing organizations
-- The current policy has an incorrect condition that references m.id instead of organizations.id
DROP POLICY IF EXISTS "View orgs you belong to" ON public.organizations;
CREATE POLICY "View orgs you belong to"
ON public.organizations
FOR SELECT
USING (EXISTS (
SELECT 1 FROM organization_members m
WHERE m.org_id = organizations.id AND m.user_id = auth.uid() AND m.deleted_at IS NULL
));