Add auth checks to et pages
This commit is contained in:
@ -14,6 +14,20 @@ import {
|
||||
} from "@chakra-ui/react";
|
||||
|
||||
export async function loader({ context }: { context: RequestContext }) {
|
||||
if (!context.data.current_user)
|
||||
throw new Response(null, {
|
||||
status: 401,
|
||||
});
|
||||
|
||||
if (
|
||||
![1 << 3, 1 << 4, 1 << 12].find(
|
||||
(p) => context.data.current_user.permissions & p,
|
||||
)
|
||||
)
|
||||
throw new Response(null, {
|
||||
status: 403,
|
||||
});
|
||||
|
||||
const etData = await context.env.D1.prepare(
|
||||
"SELECT id, name, points, roblox_id FROM et_members;",
|
||||
).all();
|
||||
|
Reference in New Issue
Block a user