Skip to content

Commit e904a79

Browse files
committed
Fix RLS
1 parent 080d811 commit e904a79

File tree

7 files changed

+33
-29
lines changed

7 files changed

+33
-29
lines changed

backend/supabase/bookmarked_searches.sql

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ DROP POLICY IF EXISTS "public read" ON bookmarked_searches;
2424
CREATE POLICY "public read" ON bookmarked_searches
2525
FOR SELECT USING (true);
2626

27-
DROP POLICY IF EXISTS "self delete" ON bookmarked_searches;
28-
CREATE POLICY "self delete" ON bookmarked_searches
29-
FOR DELETE USING (creator_id = firebase_uid());
30-
31-
DROP POLICY IF EXISTS "self insert" ON bookmarked_searches;
32-
CREATE POLICY "self insert" ON bookmarked_searches
33-
FOR INSERT WITH CHECK (creator_id = firebase_uid());
34-
35-
DROP POLICY IF EXISTS "self update" ON bookmarked_searches;
36-
CREATE POLICY "self update" ON bookmarked_searches
37-
FOR UPDATE USING (creator_id = firebase_uid());
27+
-- DROP POLICY IF EXISTS "self delete" ON bookmarked_searches;
28+
-- CREATE POLICY "self delete" ON bookmarked_searches
29+
-- FOR DELETE USING (creator_id = firebase_uid());
30+
--
31+
-- DROP POLICY IF EXISTS "self insert" ON bookmarked_searches;
32+
-- CREATE POLICY "self insert" ON bookmarked_searches
33+
-- FOR INSERT WITH CHECK (creator_id = firebase_uid());
34+
--
35+
-- DROP POLICY IF EXISTS "self update" ON bookmarked_searches;
36+
-- CREATE POLICY "self update" ON bookmarked_searches
37+
-- FOR UPDATE USING (creator_id = firebase_uid());
3838

3939
-- Indexes
4040
CREATE INDEX IF NOT EXISTS bookmarked_searches_creator_id_created_time_idx

backend/supabase/compatibility_answers.sql

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ DROP POLICY IF EXISTS "public read" ON compatibility_answers;
2929
CREATE POLICY "public read" ON compatibility_answers
3030
FOR SELECT USING (true);
3131

32-
DROP POLICY IF EXISTS "self delete" ON compatibility_answers;
33-
CREATE POLICY "self delete" ON compatibility_answers
34-
FOR DELETE USING (creator_id = firebase_uid());
35-
36-
DROP POLICY IF EXISTS "self insert" ON compatibility_answers;
37-
CREATE POLICY "self insert" ON compatibility_answers
38-
FOR INSERT WITH CHECK (creator_id = firebase_uid());
39-
40-
DROP POLICY IF EXISTS "self update" ON compatibility_answers;
41-
CREATE POLICY "self update" ON compatibility_answers
42-
FOR UPDATE USING (creator_id = firebase_uid());
32+
-- DROP POLICY IF EXISTS "self delete" ON compatibility_answers;
33+
-- CREATE POLICY "self delete" ON compatibility_answers
34+
-- FOR DELETE USING (creator_id = firebase_uid());
35+
--
36+
-- DROP POLICY IF EXISTS "self insert" ON compatibility_answers;
37+
-- CREATE POLICY "self insert" ON compatibility_answers
38+
-- FOR INSERT WITH CHECK (creator_id = firebase_uid());
39+
--
40+
-- DROP POLICY IF EXISTS "self update" ON compatibility_answers;
41+
-- CREATE POLICY "self update" ON compatibility_answers
42+
-- FOR UPDATE USING (creator_id = firebase_uid());
4343

4444
-- Indexes
4545
CREATE INDEX IF NOT EXISTS compatibility_answers_creator_id_created_time_idx

backend/supabase/compatibility_prompts.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ALTER TABLE compatibility_prompts ENABLE ROW LEVEL SECURITY;
2121
-- Policies
2222
DROP POLICY IF EXISTS "public read" ON compatibility_prompts;
2323
CREATE POLICY "public read" ON compatibility_prompts
24-
FOR ALL USING (true);
24+
FOR SELECT USING (true);
2525

2626
-- Indexes
2727
-- The primary key automatically creates a unique index on (id),

backend/supabase/private_user_message_channels.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ CREATE TABLE IF NOT EXISTS private_user_message_channels (
99
-- Row Level Security
1010
ALTER TABLE private_user_message_channels ENABLE ROW LEVEL SECURITY;
1111

12+
13+
1214
-- Policies
1315
DROP POLICY IF EXISTS "public read" ON private_user_message_channels;
14-
1516
CREATE POLICY "public read" ON private_user_message_channels
16-
FOR ALL
17-
USING (true);
17+
FOR SELECT USING (true);
1818

1919
-- Indexes
2020
-- Removed redundant primary key index creation because PRIMARY KEY already creates a unique index on id

backend/supabase/profile_comments.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ ALTER TABLE profile_comments
2626
-- Row Level Security
2727
ALTER TABLE profile_comments ENABLE ROW LEVEL SECURITY;
2828

29+
DROP POLICY IF EXISTS "public read" ON profile_comments;
30+
CREATE POLICY "public read" ON profile_comments
31+
FOR SELECT USING (true);
32+
2933
-- Policies
3034
DROP POLICY IF EXISTS "public read" ON profile_comments;
31-
CREATE POLICY "public read" ON profile_comments FOR ALL USING (true);
35+
CREATE POLICY "public read" ON profile_comments FOR SELECT USING (true);
3236

3337
-- Indexes
3438
CREATE INDEX IF NOT EXISTS profile_comments_user_id_idx

backend/supabase/vote_results.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ALTER TABLE vote_results ENABLE ROW LEVEL SECURITY;
2121
-- Policies
2222
DROP POLICY IF EXISTS "public read" ON vote_results;
2323
CREATE POLICY "public read" ON vote_results
24-
FOR ALL USING (true);
24+
FOR SELECT USING (true);
2525

2626
-- Indexes
2727
CREATE INDEX IF NOT EXISTS user_id_idx ON vote_results (user_id);

backend/supabase/votes.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ALTER TABLE votes ENABLE ROW LEVEL SECURITY;
1717
-- Policies
1818
DROP POLICY IF EXISTS "public read" ON votes;
1919
CREATE POLICY "public read" ON votes
20-
FOR ALL USING (true);
20+
FOR SELECT USING (true);
2121

2222
-- Indexes
2323
CREATE INDEX IF NOT EXISTS creator_id_idx ON votes (creator_id);

0 commit comments

Comments
 (0)