Refactor photo modification logic

This commit is contained in:
gpt-engineer-app[bot]
2025-10-02 17:46:45 +00:00
parent 6f579faa31
commit 2750d285cb
5 changed files with 224 additions and 29 deletions

View File

@@ -0,0 +1,23 @@
-- Restrict direct photo modifications - require moderation queue
-- Drop existing policies that allow direct modification
DROP POLICY IF EXISTS "Moderators can update photos" ON public.photos;
DROP POLICY IF EXISTS "Moderators can delete photos" ON public.photos;
-- Keep read policies
-- Public read access to photos already exists
-- Only service role (edge functions) can modify photos after approval
CREATE POLICY "Service role can insert photos"
ON public.photos FOR INSERT
TO service_role
WITH CHECK (true);
CREATE POLICY "Service role can update photos"
ON public.photos FOR UPDATE
TO service_role
USING (true);
CREATE POLICY "Service role can delete photos"
ON public.photos FOR DELETE
TO service_role
USING (true);