Initial commit: Kalendartool (Next.js, Prisma, Docker)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
25
app/admin/users/page.tsx
Normal file
25
app/admin/users/page.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Admin: Benutzerverwaltung (Option B).
|
||||
* Nur ADMIN-Rolle hat Zugriff; USER werden zurueck zum Dashboard geleitet.
|
||||
*/
|
||||
import { redirect } from 'next/navigation';
|
||||
import { requireDbUser } from '@/lib/api/context';
|
||||
import { UserManagement } from '@/components/admin/UserManagement';
|
||||
import { AppShell } from '@/components/layout/AppShell';
|
||||
|
||||
export default async function AdminUsersPage() {
|
||||
const user = await requireDbUser().catch(() => null);
|
||||
if (!user) {
|
||||
redirect('/login');
|
||||
}
|
||||
if (user.role !== 'ADMIN') {
|
||||
redirect('/dashboard');
|
||||
}
|
||||
|
||||
return (
|
||||
<AppShell role={user.role} userEmail={user.email} username={user.username}>
|
||||
<h1 className="mb-6 text-2xl font-bold">Benutzerverwaltung</h1>
|
||||
<UserManagement currentUserId={user.id} />
|
||||
</AppShell>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user