20 lines
579 B
TypeScript
20 lines
579 B
TypeScript
import { Error } from "_components/Error";
|
|
import { getServerSession } from "api/auth/[...nextauth]/auth";
|
|
|
|
const AdminKeywordLayout = async ({ children }: { children: React.ReactNode }) => {
|
|
const session = await getServerSession();
|
|
|
|
if (!session) return <Error title="Nicht eingeloggt" statusCode={401} />;
|
|
|
|
const user = session.user;
|
|
|
|
if (!user?.permissions.includes("ADMIN_CHANGELOG"))
|
|
return <Error title="Keine Berechtigung" statusCode={403} />;
|
|
|
|
return <>{children}</>;
|
|
};
|
|
|
|
AdminKeywordLayout.displayName = "AdminKeywordLayout";
|
|
|
|
export default AdminKeywordLayout;
|