Fix auth check for short links
This commit is contained in:
parent
3b86510e2a
commit
abedaa8d20
@ -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,
|
||||||
|
@ -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,
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user