Skip to content

Commit a9a5736

Browse files
committed
fix: Only allow admins access to LOA panel
1 parent 00541f2 commit a9a5736

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/app/admin/AdminSideNav.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ export const AdminSideNav: React.FC<AdminSideNavProps> = ({ notifications }) =>
2929
{
3030
title: 'Roster',
3131
children: [
32-
{ title: 'Approved LOAs', route: 'loa' },
32+
{
33+
title: 'Approved LOAs',
34+
route: 'loa',
35+
auth: (user) => user?.permissions.is_admin ?? false,
36+
},
3337
{
3438
title: 'Roster Purge',
3539
route: 'purge',

src/middleware.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const isLoggedIn = (token: JWT | null) => token !== null;
1010

1111
const ROUTE_AUTH_MAP: { re: RegExp, verify: (token: JWT | null) => boolean }[] = [
1212
// Need to be admin
13+
{ re: /\/admin\/loa/, verify: isAdmin },
1314
{ re: /\/admin\/purge/, verify: isAdmin },
1415
{ re: /\/admin\/queue\/loa/, verify: isAdmin },
1516
{ re: /\/admin\/queue\/visit/, verify: isAdmin },

0 commit comments

Comments
 (0)