Fix auth check for short links

This commit is contained in:
Regalijan 2024-11-01 15:03:11 -04:00
parent 3b86510e2a
commit abedaa8d20
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520
3 changed files with 7 additions and 5 deletions

View File

@ -32,9 +32,9 @@ export async function loader({ context }: { context: RequestContext }) {
}); });
if ( if (
![0, 2, 4, 5, 6, 7, 9, 10, 11, 12].find( typeof [0, 2, 4, 5, 6, 7, 9, 10, 11, 12].find(
(i) => context.data.current_user.permissions & (1 << i), (i) => context.data.current_user.permissions & (1 << i),
) ) === "undefined"
) )
throw new Response(null, { throw new Response(null, {
status: 403, status: 403,

View File

@ -27,9 +27,9 @@ export async function loader({ context }: { context: RequestContext }) {
}); });
if ( if (
![0, 2, 4, 5, 6, 7, 9, 10, 11, 12].find( typeof [0, 2, 4, 5, 6, 7, 9, 10, 11, 12].find(
(i) => context.data.current_user.permissions & (1 << i), (i) => context.data.current_user.permissions & (1 << i),
) ) === "undefined"
) )
throw new Response(null, { throw new Response(null, {
status: 403, status: 403,

View File

@ -6,7 +6,9 @@ export async function onRequest(context: RequestContext) {
if (!user) return jsonError("Unauthorized", 401); if (!user) return jsonError("Unauthorized", 401);
if ( if (
![0, 2, 4, 5, 6, 7, 9, 10, 11, 12].find((i) => user.permissions & (1 << i)) typeof [0, 2, 4, 5, 6, 7, 9, 10, 11, 12].find(
(i) => user.permissions & (1 << i),
) === "undefined"
) )
return jsonError("Forbidden", 403); return jsonError("Forbidden", 403);