From e9fd29035a3e84808808becadac653846602d5ca Mon Sep 17 00:00:00 2001 From: weeihan Date: Mon, 13 Jul 2026 10:00:17 +0800 Subject: [PATCH] fix: allow admin role to access triage and investigation pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Role guard was hse-only — admin was redirected to inbox on click. Both triage and investigation now accept hse or admin. Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01CPf5Rc8QPx6V8KLEEgfKEQ --- app/(protected)/hse/incidents/[id]/investigation/page.tsx | 2 +- app/(protected)/hse/incidents/[id]/triage/page.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/(protected)/hse/incidents/[id]/investigation/page.tsx b/app/(protected)/hse/incidents/[id]/investigation/page.tsx index 0994108..c8e1f11 100644 --- a/app/(protected)/hse/incidents/[id]/investigation/page.tsx +++ b/app/(protected)/hse/incidents/[id]/investigation/page.tsx @@ -18,7 +18,7 @@ export default async function InvestigationPage({ params }: Props) { const { data: profile } = await supabase .from('users').select('role').eq('id', data.user.id).single() - if (!profile || profile.role !== 'hse') redirect('/hse/incidents') + if (!profile || !['hse', 'admin'].includes(profile.role)) redirect('/hse/incidents') const { data: incident } = await supabase .from('incidents') diff --git a/app/(protected)/hse/incidents/[id]/triage/page.tsx b/app/(protected)/hse/incidents/[id]/triage/page.tsx index 7721fcd..fa3acd4 100644 --- a/app/(protected)/hse/incidents/[id]/triage/page.tsx +++ b/app/(protected)/hse/incidents/[id]/triage/page.tsx @@ -18,7 +18,7 @@ export default async function TriagePage({ params }: Props) { const { data: profile } = await supabase .from('users').select('role').eq('id', data.user.id).single() - if (!profile || profile.role !== 'hse') redirect('/hse/incidents') + if (!profile || !['hse', 'admin'].includes(profile.role)) redirect('/hse/incidents') const { data: incident } = await supabase .from('incidents')