Fix: Update is_moderator function

This commit is contained in:
gpt-engineer-app[bot]
2025-09-28 23:41:01 +00:00
parent 0d46ff4597
commit 624de77992

View File

@@ -0,0 +1,14 @@
-- Update is_moderator function to include superusers
CREATE OR REPLACE FUNCTION public.is_moderator(_user_id uuid)
RETURNS boolean
LANGUAGE sql
STABLE SECURITY DEFINER
SET search_path TO 'public'
AS $function$
SELECT EXISTS (
SELECT 1
FROM public.user_roles
WHERE user_id = _user_id
AND role IN ('moderator', 'admin', 'superuser')
)
$function$;