Skip to content

Commit

Permalink
Merge pull request #16 from diggerhq/feat/rls-runs
Browse files Browse the repository at this point in the history
RLS for runs
  • Loading branch information
ZIJ authored Aug 12, 2024
2 parents cff17fb + ad3f549 commit 330993a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions supabase/migrations/20240812103454_rls_runs.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Enable RLS on digger_runs table
ALTER TABLE digger_runs ENABLE ROW LEVEL SECURITY;

-- Create policy for digger_runs
CREATE POLICY "Users can access digger_runs in their organizations" ON digger_runs
FOR ALL USING (
EXISTS (
SELECT 1
FROM projects p
JOIN organizations o ON p.organization_id = o.id
JOIN organization_members om ON o.id = om.organization_id
WHERE digger_runs.project_id = p.id
AND om.member_id = auth.uid()
)
);

0 comments on commit 330993a

Please sign in to comment.