Skip to content

Commit

Permalink
Merge pull request #137 from ystv/user-management
Browse files Browse the repository at this point in the history
  • Loading branch information
archessmn authored Oct 1, 2024
2 parents de2733d + fd9e99a commit a17b617
Show file tree
Hide file tree
Showing 50 changed files with 2,260 additions and 386 deletions.
3 changes: 0 additions & 3 deletions app/(authenticated)/(superuser)/admin/page.tsx

This file was deleted.

76 changes: 0 additions & 76 deletions app/(authenticated)/(superuser)/admin/positions/page.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions app/(authenticated)/(superuser)/layout.tsx

This file was deleted.

15 changes: 15 additions & 0 deletions app/(authenticated)/admin/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import ErrorPage from "@/components/ErrorPage";
import { hasPermission } from "@/lib/auth/server";
import { notFound } from "next/navigation";

export default async function AuthenticatedLayout({
children,
}: {
children: React.ReactNode;
}) {
if (await hasPermission("Admin.Positions", "Admin.Roles", "Admin.Users")) {
return <>{children}</>;
} else {
return <ErrorPage code={403} message="Forbidden" />;
}
}
22 changes: 22 additions & 0 deletions app/(authenticated)/admin/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Button, Card, Stack } from "@mantine/core";
import Link from "next/link";

export const dynamic = "force-dynamic";

export default function AdminPage() {
return (
<Card>
<Stack>
<Link href={"/admin/users"}>
<Button variant="default">Users</Button>
</Link>
<Link href={"/admin/positions"}>
<Button variant="default">Crew Positions</Button>
</Link>
<Link href={"/admin/roles"}>
<Button variant="default">Roles</Button>
</Link>
</Stack>
</Card>
);
}
Loading

0 comments on commit a17b617

Please sign in to comment.