Files
thrilltrack-explorer/supabase/migrations/20251111011244_62ebd15f-c783-489a-9088-9dc3e0268f8e.sql
gpt-engineer-app[bot] 5d35fdc326 Enable alert resolution policy
Allow moderators to resolve rate limit alerts by adding UPDATE policy on rate_limit_alerts and granting UPDATE to authenticated users. This completes enabling the Resolve action for alerts.
2025-11-11 01:12:56 +00:00

22 lines
524 B
SQL

-- Add UPDATE policy for resolving alerts
CREATE POLICY "Moderators can resolve alerts"
ON public.rate_limit_alerts
FOR UPDATE
TO authenticated
USING (
EXISTS (
SELECT 1 FROM public.user_roles
WHERE user_id = auth.uid()
AND role IN ('admin', 'moderator', 'superuser')
)
)
WITH CHECK (
EXISTS (
SELECT 1 FROM public.user_roles
WHERE user_id = auth.uid()
AND role IN ('admin', 'moderator', 'superuser')
)
);
-- Grant UPDATE permission
GRANT UPDATE ON public.rate_limit_alerts TO authenticated;