Neah/app/api/users/[userId]/roles/route.ts
2025-05-03 13:50:19 +02:00

51 lines
1.3 KiB
TypeScript

import { NextResponse } from "next/server";
import { getServerSession } from "next-auth";
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
export async function GET(
request: Request,
{ params }: { params: { userId: string } }
) {
try {
const session = await getServerSession(authOptions);
if (!session) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
// Keycloak functionality has been removed
return NextResponse.json(
{ error: "This functionality is not available" },
{ status: 501 }
);
} catch (error) {
console.error("Error fetching roles:", error);
return NextResponse.json(
{ error: "Failed to fetch roles" },
{ status: 500 }
);
}
}
export async function PUT(
request: Request,
{ params }: { params: { userId: string } }
) {
try {
const session = await getServerSession(authOptions);
if (!session) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
// Keycloak functionality has been removed
return NextResponse.json(
{ error: "This functionality is not available" },
{ status: 501 }
);
} catch (error) {
console.error("Error updating roles:", error);
return NextResponse.json(
{ error: "Failed to update roles" },
{ status: 500 }
);
}
}