Add actual permission check to appeal toggle endpoint
This commit is contained in:
parent
894baedb27
commit
9e44a7e0a1
@ -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"}', {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user