mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 06:51:12 -05:00
14 lines
371 B
SQL
14 lines
371 B
SQL
-- 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$; |