Add mdx support for Events content
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
-- Create storage bucket for rich text content images
|
||||
insert into storage.buckets (id, name, public)
|
||||
values ('event-content-images', 'event-content-images', true)
|
||||
on conflict (id) do nothing;
|
||||
|
||||
-- Allow public read access to content images
|
||||
create policy "content_images_select_public" on storage.objects
|
||||
for select
|
||||
using (bucket_id = 'event-content-images');
|
||||
|
||||
-- Allow authenticated admins to upload content images
|
||||
create policy "content_images_insert_admin" on storage.objects
|
||||
for insert
|
||||
with check (
|
||||
bucket_id = 'event-content-images'
|
||||
and auth.role() = 'authenticated'
|
||||
and exists (
|
||||
select 1 from public.profiles p
|
||||
where p.id = auth.uid()
|
||||
and p.is_admin
|
||||
)
|
||||
);
|
||||
|
||||
-- Allow authenticated admins to update content images
|
||||
create policy "content_images_update_admin" on storage.objects
|
||||
for update
|
||||
using (
|
||||
bucket_id = 'event-content-images'
|
||||
and auth.role() = 'authenticated'
|
||||
and exists (
|
||||
select 1 from public.profiles p
|
||||
where p.id = auth.uid()
|
||||
and p.is_admin
|
||||
)
|
||||
);
|
||||
|
||||
-- Allow authenticated admins to delete content images
|
||||
create policy "content_images_delete_admin" on storage.objects
|
||||
for delete
|
||||
using (
|
||||
bucket_id = 'event-content-images'
|
||||
and auth.role() = 'authenticated'
|
||||
and exists (
|
||||
select 1 from public.profiles p
|
||||
where p.id = auth.uid()
|
||||
and p.is_admin
|
||||
)
|
||||
);
|
||||
Reference in New Issue
Block a user