Create point route middleware

This commit is contained in:
Regalijan 2024-02-27 16:16:27 -05:00
parent dd24dfef4a
commit 3451f08e7c
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -0,0 +1,12 @@
import { jsonError } from "../../../common.js";
export async function onRequest(context: RequestContext) {
const { current_user: user } = context.data;
if (!user) return jsonError("You are not logged in", 401);
if (![1 << 3, 1 << 4, 1 << 2].find((p) => user.permissions & p))
return jsonError("Not part of Events Team", 403);
return await context.next();
}