Skip to content

Commit

Permalink
chore: Fix RBAC
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya-Jyoti committed Dec 26, 2024
1 parent cb9701a commit 857d94a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/lib/auth-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down

0 comments on commit 857d94a

Please sign in to comment.