Create point route middleware
This commit is contained in:
parent
dd24dfef4a
commit
3451f08e7c
12
functions/api/events-team/points/_middleware.ts
Normal file
12
functions/api/events-team/points/_middleware.ts
Normal 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();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user