Skip to content

Commit

Permalink
change to custom:user_roles
Browse files Browse the repository at this point in the history
  • Loading branch information
anyoussefinia committed Dec 12, 2024
1 parent 1888c43 commit 4bb4252
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions services/ui-src/src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ const isAdminUser = ()=> {
idTokenKey && localStorage.getItem(idTokenKey[0]);
if (!idToken) return false;
const decodedIdToken: any = jwt_decode(idToken);
let userRoles = decodedIdToken["custom:user_roles"];

const allowedRoles = [
"cmsroleapprover",
Expand All @@ -165,8 +166,7 @@ const isAdminUser = ()=> {
];

// only passes admin check if roles from jwt one of the "allowed roles"
if (decodedIdToken?.user_roles) {
let userRoles = decodedIdToken.user_roles;
if (userRoles) {
try {
userRoles = JSON.parse(userRoles);
} catch (error) {
Expand Down

0 comments on commit 4bb4252

Please sign in to comment.