From 857d94a3425797ace48c231353ddf270da8c9cff Mon Sep 17 00:00:00 2001 From: Aditya Jyoti Date: Thu, 26 Dec 2024 18:49:37 +0530 Subject: [PATCH] chore: Fix RBAC --- src/lib/auth-provider.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib/auth-provider.ts b/src/lib/auth-provider.ts index 3b5b3aa..b256d04 100644 --- a/src/lib/auth-provider.ts +++ b/src/lib/auth-provider.ts @@ -23,7 +23,6 @@ export const middleware = async (ctx: Context, next: Next) => { ) as JWTPayload; ctx.set("user", decoded); - ctx.set("role", decoded.role); await next(); } catch { ctx.status(401); @@ -33,7 +32,7 @@ export const middleware = async (ctx: Context, next: Next) => { }; export const checkRole = (roles: Role[], ctx: Context) => { - if (!roles.includes(ctx.get("role"))) { + if (!roles.includes(ctx.get("user").role)) { return false; }