Skip to content

Commit d45b91c

Browse files
committed
Updates the policies for the storage example
1 parent 8749488 commit d45b91c

File tree

5 files changed

+6076
-50
lines changed

5 files changed

+6076
-50
lines changed

example/next-storage/README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,15 @@ create policy "Public profiles are viewable by everyone." on profiles for select
2323
create policy "Users can insert their own profile." on profiles for insert with check (auth.uid() = id);
2424
create policy "Users can update own profile." on profiles for update using (auth.uid() = id);
2525

26-
2726
-- Set up Realtime!
2827
begin;
2928
drop publication if exists supabase_realtime;
3029
create publication supabase_realtime;
3130
commit;
32-
3331
alter publication supabase_realtime add table profiles;
3432

3533
-- Set up Storage!
3634
insert into storage.buckets (id, name) values ('avatars', 'avatars');
37-
create policy "Avatar images are publicly accessible." on storage.objects for select using (true);
38-
create policy "Inserted avatar file name starts with the user's id." on storage.objects for insert with check (auth.uid()::text = substring(name, 1, 36));
39-
create policy "Updated avatar file name starts with the user's id." on storage.objects for update with check (auth.uid()::text = substring(name, 1, 36));
35+
create policy "Avatar images are publicly accessible." on storage.objects for select using ( bucket_id = 'avatars' );
36+
create policy "Anyone can upload an avatar." on storage.objects for insert using ( bucket_id = 'avatars' );
4037
```

example/next-storage/components/Auth.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ export default function Auth({}) {
2424
return (
2525
<div className="authContainer">
2626
<div className="authTitle">
27-
<h1 className="header">Experience our open-source storage system</h1>
27+
<h1 className="header">Experience our open source storage system</h1>
2828
<p className="description">
29-
Through a simple profile management example. Create your user profile and upload an avatar
30-
image - Fast, simple, secure.
29+
Through a simple profile management example. Create a user profile and upload an avatar
30+
image. Fast, simple, secure.
3131
</p>
3232
</div>
3333
<div className="authWidget" style={{ display: 'flex', gap: 20, flexDirection: 'column' }}>

0 commit comments

Comments
 (0)