Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Actually make game mod role work
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent 7e97861 commit 85d4fe0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions functions/api/auth/session.ts
Expand Up @@ -112,10 +112,14 @@ export async function onRequestGet(context: RequestContext) {
const memberData: { [k: string]: any } = await serverMemberReq.json();

if (serverMemberReq.ok) {
userData.permissions = await GetPermissions(userData.id, memberData.roles);
userData.permissions = await GetPermissions(
userData.id,
context,
memberData.roles,
);
userData.roles = memberData.roles;
} else {
userData.permissions = await GetPermissions(userData.id);
userData.permissions = await GetPermissions(userData.id, context);
}

const selectedTokenStart =
Expand Down
4 changes: 2 additions & 2 deletions functions/permissions.ts
@@ -1,7 +1,7 @@
export default async function (
userid: string,
context: RequestContext,
roles?: string[],
context?: RequestContext,
): Promise<number> {
let permissions = 0;

Expand All @@ -14,7 +14,7 @@ export default async function (
["165594923586945025", "289372404541554689", "396347223736057866"].includes(
userid,
) ||
Boolean(await context?.env.DATA.get(`gamemod_${userid}`))
Boolean(await context.env.DATA.get(`gamemod_${userid}`))
)
permissions |= 1 << 5;
if (
Expand Down

0 comments on commit 85d4fe0

Please sign in to comment.