Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add basic events api middleware
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent d620e04 commit 09d3704
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions functions/api/events-team/events/_middleware.ts
@@ -0,0 +1,15 @@
export async function onRequest(context: RequestContext) {
if (
![1 << 3, 1 << 4, 1 << 12].find(
(int) => context.data.current_user?.permissions & int,
)
)
return new Response('{"error":"Forbidden"}', {
headers: {
"content-type": "application/json",
},
status: 401,
});

return await context.next();
}

0 comments on commit 09d3704

Please sign in to comment.