Add basic events api middleware
This commit is contained in:
parent
d620e04e21
commit
09d37041bc
15
functions/api/events-team/events/_middleware.ts
Normal file
15
functions/api/events-team/events/_middleware.ts
Normal file
@ -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();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user