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
This commit is contained in:
Randall Stillwell 2026-04-16 00:22:32 -05:00
parent 19270ef6ec
commit 42df7fc995
3 changed files with 3 additions and 3 deletions

View file

@ -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";

View file

@ -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 });
}

View file

@ -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");