-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
) | ||
); |