Add auth checks to et pages
This commit is contained in:
@ -31,6 +31,15 @@ export async function loader({ context }: { context: RequestContext }) {
|
||||
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 monthEventList = await context.env.D1.prepare(
|
||||
"SELECT answer, approved, created_by, day, details, id, month, pending, type, year FROM events WHERE month = ? AND year = ?;",
|
||||
|
Reference in New Issue
Block a user