From 42df7fc995bf445a00653ea0bb6dd46048f7d3fd Mon Sep 17 00:00:00 2001 From: Randall Stillwell Date: Thu, 16 Apr 2026 00:22:32 -0500 Subject: [PATCH] Fix admin role check to include owner role The org membership role is "owner" but UI components only checked for "admin", hiding action buttons (reprocess, push, export, etc.) for org owners. Update isAdmin checks in card detail page and dashboard, plus the delete API route, to include "owner". Made-with: Cursor --- src/app/(dashboard)/cards/[id]/page.tsx | 2 +- src/app/api/cards/[id]/route.ts | 2 +- src/components/cards/dashboard-content.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/(dashboard)/cards/[id]/page.tsx b/src/app/(dashboard)/cards/[id]/page.tsx index db4625d..c91e03c 100644 --- a/src/app/(dashboard)/cards/[id]/page.tsx +++ b/src/app/(dashboard)/cards/[id]/page.tsx @@ -132,7 +132,7 @@ export default function CardDetailPage() { const router = useRouter(); const id = params.id as string; const { role, userId } = useUserProfile(); - const isAdmin = role === "admin"; + const isAdmin = role === "admin" || role === "owner"; const isReviewer = role === "reviewer"; const isViewer = role === "viewer"; diff --git a/src/app/api/cards/[id]/route.ts b/src/app/api/cards/[id]/route.ts index 817fa19..3fd724d 100644 --- a/src/app/api/cards/[id]/route.ts +++ b/src/app/api/cards/[id]/route.ts @@ -183,7 +183,7 @@ export async function DELETE( ) { try { const user = await getOrCreateUser(request.headers); - if (user && user.role !== "admin") { + if (user && user.role !== "admin" && user.role !== "owner") { return NextResponse.json({ error: "Only admins can delete cards" }, { status: 403 }); } diff --git a/src/components/cards/dashboard-content.tsx b/src/components/cards/dashboard-content.tsx index 4e59512..d6f9b8f 100644 --- a/src/components/cards/dashboard-content.tsx +++ b/src/components/cards/dashboard-content.tsx @@ -31,7 +31,7 @@ export function DashboardContent() { const router = useRouter(); const searchParams = useSearchParams(); const { role } = useUserProfile(); - const isAdmin = role === "admin"; + const isAdmin = role === "admin" || role === "owner"; const page = parseInt(searchParams.get("page") || "1"); const limit = parseInt(searchParams.get("limit") || "20");