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:
parent
19270ef6ec
commit
42df7fc995
3 changed files with 3 additions and 3 deletions
|
|
@ -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";
|
||||
|
||||
|
|
|
|||
|
|
@ -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 });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue