Fixed Wrong IP being loged
This commit is contained in:
19
apps/hub/app/(app)/admin/log/layout.tsx
Normal file
19
apps/hub/app/(app)/admin/log/layout.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Error } from "_components/Error";
|
||||
import { getServerSession } from "api/auth/[...nextauth]/auth";
|
||||
|
||||
const AdminAccountLogLayout = 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_USER_ADVANCED"))
|
||||
return <Error title="Keine Berechtigung" statusCode={403} />;
|
||||
|
||||
return <>{children}</>;
|
||||
};
|
||||
|
||||
AdminAccountLogLayout.displayName = "AdminAccountLogLayout";
|
||||
|
||||
export default AdminAccountLogLayout;
|
||||
Reference in New Issue
Block a user