Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INT-141] [INT-142] User and role management #137

Merged
merged 25 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2fe553d
Wow I made a lot of changes
archessmn May 29, 2024
29718e6
Add some permissions instead of requiring SuperUser
archessmn Jun 15, 2024
6d80342
Merge branch 'main' of https://github.com/ystv/experimental-hypotheti…
archessmn Aug 20, 2024
4cb9d9a
Merge branch 'main' of https://github.com/ystv/internal-site into use…
archessmn Sep 2, 2024
10abfaf
Add Role creation, editing and deleting, tidy up other pages
archessmn Sep 3, 2024
a7c9d18
Fix required permissions
archessmn Sep 3, 2024
d60b834
Update page.tsx
archessmn Sep 3, 2024
04022a0
Rename /user/[id] page to /user/me and remove dead code
archessmn Sep 3, 2024
8aeaa24
Rename getSearchParams to rawSearchParams
archessmn Sep 3, 2024
136abdb
Better feedback on give user role fail
archessmn Sep 3, 2024
511c8bf
Add documentation
archessmn Sep 3, 2024
91f9314
Rename admin permissions and remove unused ones
archessmn Sep 3, 2024
f6c3510
Remove old permissions and multi-user references
archessmn Sep 4, 2024
7fd5da4
Merge branch 'main' into user-management
archessmn Sep 4, 2024
b82ef7f
Switch admin page data fetching to tanstack query
archessmn Sep 5, 2024
4efd013
Remove unused contexts
archessmn Sep 5, 2024
8ca9503
Merge branch 'main' into user-management
archessmn Sep 15, 2024
6c10fe2
Correct permissions in layouts for admin pages
archessmn Sep 18, 2024
15b28c2
Merge branch 'main' into user-management
archessmn Sep 18, 2024
8576930
Update app/(authenticated)/admin/users/UserView.tsx
archessmn Sep 19, 2024
d4dc939
Update app/(authenticated)/admin/roles/RoleCard.tsx
archessmn Sep 19, 2024
73ff3ff
Update app/(authenticated)/admin/roles/RoleView.tsx
archessmn Sep 19, 2024
8ec2677
Remove unused use server declarations
archessmn Sep 23, 2024
fb244de
Error logging and permissions handling
archessmn Sep 23, 2024
fd9e99a
Fix build errors
archessmn Sep 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading