Skip to content

Commit e5f9bf9

Browse files
committed
Document RLS
1 parent 887c023 commit e5f9bf9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

data/supabase/rls-policies.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,28 @@ FYI: `DELETE POST` cascade to `COMMENT`s and `VOTE`s
3131
- Only `VOTE`s where auth user is `profileId` can `DELETE`
3232

3333
Note: Does this mean I can see how people voted?
34+
35+
## Export of Policies
36+
37+
See: [row_level_security_polices.csv](../db/row_level_security_polices.csv)
38+
39+
| schemaname | tablename | policyname | permissive | roles | cmd | qual | with_check |
40+
| ---------- | --------- | ----------------------------------------- | ---------- | -------- | ------ | ----------------------------- | ------------------------------------- |
41+
| public | Profile | Public profiles are viewable by everyone. | PERMISSIVE | {public} | SELECT | true | |
42+
| public | Profile | Users can insert their own profile. | PERMISSIVE | {public} | INSERT | | (auth.uid() = id) |
43+
| public | Profile | Users can update own profile. | PERMISSIVE | {public} | UPDATE | (auth.uid() = id) | |
44+
| storage | objects | Avatar images are publicly accessible. | PERMISSIVE | {public} | SELECT | (bucket_id = 'avatars'::text) | |
45+
| storage | objects | Anyone can upload an avatar. | PERMISSIVE | {public} | INSERT | | (bucket_id = 'avatars'::text) |
46+
| storage | objects | Anyone can update an avatar. | PERMISSIVE | {public} | UPDATE | | (bucket_id = 'avatars'::text) |
47+
| public | Post | All users can view posts | PERMISSIVE | {public} | SELECT | true | |
48+
| public | Post | Only authenticated users can create posts | PERMISSIVE | {public} | INSERT | | (auth.role() = 'authenticated'::text) |
49+
| public | Post | Users can delete their own posts | PERMISSIVE | {public} | DELETE | (auth.uid() = "profileId") | |
50+
| public | Post | Users can edit their own posts | PERMISSIVE | {public} | UPDATE | (auth.uid() = "profileId") | (auth.uid() = "profileId") |
51+
| public | Comment | Everyone can view comments | PERMISSIVE | {public} | SELECT | true | |
52+
| public | Comment | Only authenticated users can comment | PERMISSIVE | {public} | INSERT | | (auth.role() = 'authenticated'::text) |
53+
| public | Comment | User can edit their own comments | PERMISSIVE | {public} | UPDATE | (auth.uid() = "profileId") | (auth.uid() = "profileId") |
54+
| public | Comment | Users can delete their own comments | PERMISSIVE | {public} | DELETE | (auth.uid() = "profileId") | |
55+
| public | Vote | Everyone can view votes | PERMISSIVE | {public} | SELECT | true | |
56+
| public | Vote | Only authenticated users can vote | PERMISSIVE | {public} | INSERT | | (auth.role() = 'authenticated'::text) |
57+
| public | Vote | Users can change their vote | PERMISSIVE | {public} | UPDATE | (auth.uid() = "profileId") | (auth.uid() = "profileId") |
58+
| public | Vote | Users can delete their own votes | PERMISSIVE | {public} | DELETE | (auth.uid() = "profileId") | |

0 commit comments

Comments
 (0)