diff --git a/app/routes/events-calendar.tsx b/app/routes/events-calendar.tsx index ad02fd9..3213e09 100644 --- a/app/routes/events-calendar.tsx +++ b/app/routes/events-calendar.tsx @@ -10,6 +10,20 @@ export const links: LinksFunction = () => { }; export async function loader({ context }: { context: RequestContext }) { + if (!context.data.current_user) + throw new Response(null, { + status: 401, + }); + + if ( + [1 << 3, 1 << 4, 1 << 12].find( + (p) => context.data.current_user.permissions & p, + ) + ) + throw new Response(null, { + status: 403, + }); + const now = new Date(); const eventsData = await context.env.D1.prepare( "SELECT answer, approved, created_by, day, details, id, month, pending, performed_at, reached_minimum_player_count, type, year FROM events WHERE month = ? AND year = ? ORDER BY day;",