Files
thrilltrack-explorer/supabase/migrations/20251111132055_28316757-cf2c-462e-837e-95ca9751e79d.sql
gpt-engineer-app[bot] 2093560f64 Connect to Lovable Cloud
Implement monitoring and alert-resolve UI improvements:
- Enhance useAlertGroupActions with robust error handling and breadcrumb logging
- Add loading state visuals to GroupedAlertsPanel and Resolve All button
- Integrate loading indicator (Loader2) for better user feedback during resolves
2025-11-11 13:21:58 +00:00

38 lines
967 B
SQL

-- Add UPDATE policy for rate_limit_alerts to allow moderators to resolve alerts
CREATE POLICY "Moderators can resolve rate limit 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 (
-- Only allow updating resolved_at field
resolved_at IS NOT NULL
);
-- Update system_alerts policy to allow moderators to resolve alerts
DROP POLICY IF EXISTS "Admins can manage system alerts" ON public.system_alerts;
CREATE POLICY "Staff can manage system alerts"
ON public.system_alerts
FOR UPDATE
TO authenticated
USING (
EXISTS (
SELECT 1 FROM public.user_roles
WHERE user_id = auth.uid()
AND role IN ('admin', 'superuser', 'moderator')
)
)
WITH CHECK (
EXISTS (
SELECT 1 FROM public.user_roles
WHERE user_id = auth.uid()
AND role IN ('admin', 'superuser', 'moderator')
)
);