Skip to content

Commit 07d868a

Browse files
committed
Adds RLS policies
1 parent 4dbcd6a commit 07d868a

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

data/db/rls_policies.csv

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
schemaname,tablename,policyname,permissive,roles,cmd,qual,with_check
2+
public,Profile,Public profiles are viewable by everyone.,PERMISSIVE,{public},SELECT,true,
3+
public,Profile,Users can insert their own profile.,PERMISSIVE,{public},INSERT,,(auth.uid() = id)
4+
public,Profile,Users can update own profile.,PERMISSIVE,{public},UPDATE,(auth.uid() = id),
5+
storage,objects,Avatar images are publicly accessible.,PERMISSIVE,{public},SELECT,"(bucket_id = 'avatars'::text)",
6+
storage,objects,Anyone can upload an avatar.,PERMISSIVE,{public},INSERT,,"(bucket_id = 'avatars'::text)"
7+
storage,objects,Anyone can update an avatar.,PERMISSIVE,{public},UPDATE,,"(bucket_id = 'avatars'::text)"
8+
public,Post,All users can view posts,PERMISSIVE,{public},SELECT,true,
9+
public,Post,Only authenticated users can create posts,PERMISSIVE,{public},INSERT,,"(auth.role() = 'authenticated'::text)"
10+
public,Post,Users can delete their own posts,PERMISSIVE,{public},DELETE,"(auth.uid() = ""profileId"")",
11+
public,Post,Users can edit their own posts,PERMISSIVE,{public},UPDATE,"(auth.uid() = ""profileId"")","(auth.uid() = ""profileId"")"
12+
public,Comment,Everyone can view comments,PERMISSIVE,{public},SELECT,true,
13+
public,Comment,Only authenticated users can comment,PERMISSIVE,{public},INSERT,,"(auth.role() = 'authenticated'::text)"
14+
public,Comment,User can edit their own comments,PERMISSIVE,{public},UPDATE,"(auth.uid() = ""profileId"")","(auth.uid() = ""profileId"")"
15+
public,Comment,Users can delete their own comments,PERMISSIVE,{public},DELETE,"(auth.uid() = ""profileId"")",
16+
public,Vote,Everyone can view votes,PERMISSIVE,{public},SELECT,true,
17+
public,Vote,Only authenticated users can vote,PERMISSIVE,{public},INSERT,,"(auth.role() = 'authenticated'::text)"
18+
public,Vote,Users can change their vote,PERMISSIVE,{public},UPDATE,"(auth.uid() = ""profileId"")","(auth.uid() = ""profileId"")"
19+
public,Vote,Users can delete their own votes,PERMISSIVE,{public},DELETE,"(auth.uid() = ""profileId"")",

0 commit comments

Comments
 (0)