From 9442d03f63a55a9ced182fc3fe4bd3fee70f4086 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 7 Aug 2026 20:47:23 +0000 Subject: [PATCH] Terminal --- supabase/migrations/20260807002000_reporting_view_fixes.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/supabase/migrations/20260807002000_reporting_view_fixes.sql b/supabase/migrations/20260807002000_reporting_view_fixes.sql index d302e8a..96109c5 100644 --- a/supabase/migrations/20260807002000_reporting_view_fixes.sql +++ b/supabase/migrations/20260807002000_reporting_view_fixes.sql @@ -27,10 +27,12 @@ LANGUAGE sql STABLE SECURITY DEFINER SET search_path = public AS $$ WHERE s.id = _student -- SECURITY DEFINER bypasses the students policy, so the entitlement is -- re-checked here. Without this an authenticated caller could resolve any - -- student's name by guessing uuids. + -- student's name by guessing uuids. The service_role arm keeps server-side + -- rendering working, since it holds no app role and would otherwise get NULL. AND (public.can_access_student(_student) OR public.is_billing_admin() - OR public.is_auditor()); + OR public.is_auditor() + OR pg_has_role(current_user, 'service_role', 'MEMBER')); $$; GRANT EXECUTE ON FUNCTION public.student_display_name(UUID) TO authenticated;