Marky
08/16/2021, 4:52 PMnyellin
08/16/2021, 8:17 PMnyellin
08/16/2021, 8:17 PMnyellin
08/16/2021, 8:17 PMnyellin
08/16/2021, 8:18 PMnyellin
08/16/2021, 8:18 PMnyellin
08/16/2021, 8:18 PMScott P
08/16/2021, 8:26 PMnyellin
08/16/2021, 8:38 PMnyellin
08/16/2021, 8:38 PMnyellin
08/16/2021, 8:38 PMnyellin
08/16/2021, 8:38 PMPeanut
08/17/2021, 2:08 AMrotimi-best
08/17/2021, 4:40 AMsilentworks
08/17/2021, 2:46 PMjonny
08/17/2021, 3:36 PMjonny
08/17/2021, 3:36 PMjonny
08/17/2021, 3:37 PMflorian-lefebvre
08/17/2021, 3:41 PMjonny
08/17/2021, 5:45 PMjonny
08/17/2021, 5:48 PMjonny
08/17/2021, 5:49 PMmikesky
08/17/2021, 9:43 PMdarora
08/18/2021, 2:23 AMPeanut
08/18/2021, 3:56 AM{
match /tables/public/user_profiles {
match /{id=**}/ {
allow read;
allow write: if "id" = auth.uid();
}
}
}
Could be translated into (my SQL isn't very good):
sql
ALTER TABLE user_profiles
ENABLE ROW LEVEL SECURITY;
CREATE POLICY "read"
ON user_profiles FOR SELECT USING (
true
);
CREATE POLICY "write"
ON users FOR UPDATE USING (
auth.uid() = id
);
Peanut
08/18/2021, 3:56 AMs u s h i
08/18/2021, 7:18 AMRichCorbs
08/18/2021, 2:19 PMauth.user()
function (similar to auth.id() and auth.user_id()) that returns public.users WHERE users.auth_id = auth.id() LIMIT 1
(probably not the right syntax but you get the intent) so that ANY attribute on the matching user record can be used in a policy.jonny
08/18/2021, 4:59 PMPeanut
08/19/2021, 4:50 AM