12 lines
336 B
TypeScript
12 lines
336 B
TypeScript
import { jsonError } from "../../common.js";
|
|
|
|
export async function onRequest(context: RequestContext) {
|
|
const { current_user: currentUser } = context.data;
|
|
|
|
if (!currentUser) return jsonError("Not logged in", 401);
|
|
|
|
if (!(currentUser.permissions & (1 << 5))) return jsonError("Forbidden", 403);
|
|
|
|
return await context.next();
|
|
}
|