Original working file
policies.sql
Code and working example pages keep their original identifiers and sample text. The lesson and file guidance explain them in your language.
create policy "upload own avatar" on storage.objects for insert to authenticated
with check (bucket_id='avatars' and (storage.foldername(name))[1]=auth.uid()::text);
create policy "read own avatar" on storage.objects for select to authenticated
using (bucket_id='avatars' and (storage.foldername(name))[1]=auth.uid()::text);