Add actual permission check to appeal toggle endpoint

This commit is contained in:
regalijan 2023-10-19 16:49:11 -04:00
parent 894baedb27
commit 9e44a7e0a1
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -1,5 +1,14 @@
export async function onRequestPost(context: RequestContext) { export async function onRequestPost(context: RequestContext) {
const { active } = context.data.body; const { active } = context.data.body;
const { permissions } = context.data.current_user;
if (!(permissions & (1 << 0)) || !(permissions & (1 << 11)))
return new Response('{"error":"Forbidden"}', {
headers: {
"content-type": "application/json",
},
status: 403,
});
if (typeof active !== "boolean") if (typeof active !== "boolean")
return new Response('{"error":"Active property must be a boolean"}', { return new Response('{"error":"Active property must be a boolean"}', {