Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Commit

Permalink
update session roles
Browse files Browse the repository at this point in the history
  • Loading branch information
lukesthl committed Sep 16, 2023
1 parent b9dee2a commit c3e5d8a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/app.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import {
SessionClaimValidator,
SessionContainer,
} from 'supertokens-node/recipe/session';
import UserRoles from 'supertokens-node/recipe/userroles';
import UserRoles, {
PermissionClaim,
UserRoleClaim,
} from 'supertokens-node/recipe/userroles';
import { AuthGuard } from './auth/filter/auth.guard';

@Controller()
Expand Down Expand Up @@ -65,6 +68,9 @@ export class AppController {
session.getUserId(),
'admin',
);

await session.fetchAndSetClaim(UserRoleClaim);
await session.fetchAndSetClaim(PermissionClaim);
return response;
}

Expand All @@ -86,6 +92,8 @@ export class AppController {
session.getUserId(),
'admin',
);
await session.fetchAndSetClaim(UserRoleClaim);
await session.fetchAndSetClaim(PermissionClaim);
return response;
}
}

0 comments on commit c3e5d8a

Please sign in to comment.