From 514b97c31641dfda84bac4637c569fee360f151a Mon Sep 17 00:00:00 2001 From: regalijan Date: Thu, 19 Oct 2023 16:50:31 -0400 Subject: [PATCH] Add et member management middleware --- .../api/events-team/team-members/_middleware.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 functions/api/events-team/team-members/_middleware.ts diff --git a/functions/api/events-team/team-members/_middleware.ts b/functions/api/events-team/team-members/_middleware.ts new file mode 100644 index 0000000..f16342b --- /dev/null +++ b/functions/api/events-team/team-members/_middleware.ts @@ -0,0 +1,13 @@ +export async function onRequest(context: RequestContext) { + if ( + ![1 << 4, 1 << 12].find((p) => context.data.current_user?.permissions & p) + ) + return new Response('{"error":"Forbidden"}', { + headers: { + "content-type": "application/json", + }, + status: 403, + }); + + return await context.next(); +}