Refactor admin blog access

This commit is contained in:
gpt-engineer-app[bot]
2025-10-10 23:03:05 +00:00
parent bc08d44f4c
commit 14d7801b6f
3 changed files with 34 additions and 8 deletions

View File

@@ -0,0 +1,10 @@
-- Drop existing policy that allows moderators
DROP POLICY IF EXISTS "Admins can do everything" ON public.blog_posts;
-- Create new policy for admins and superusers only
CREATE POLICY "Admins and superusers can manage blog posts"
ON public.blog_posts FOR ALL
USING (
has_role(auth.uid(), 'admin'::app_role) OR
has_role(auth.uid(), 'superuser'::app_role)
);