Skip to content

Commit

Permalink
[#202] Refactor SecurityUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
palagdan authored and blcham committed Oct 9, 2024
1 parent 59aef6b commit c2be3e7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/SecurityUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export function hasRole(user, role) {
return user.roles ? user.roles.includes(role) : false;
}

export function isImpersonator(currentUser) {
export function isImpersonator(user) {
// When using OIDC, the access token does not contain any info that the current user is being impersonated
return !isUsingOidcAuth() && sanitizeArray(currentUser.types).indexOf(IMPERSONATOR_TYPE) !== -1;
return !isUsingOidcAuth() && user.roles.includes(ROLE.IMPERSONATE);
}

export function getRoles(user) {
Expand All @@ -36,6 +36,6 @@ export function getRoles(user) {
return user.roleGroup.roles;
}

function isRoleExist(role) {
function roleExists(role) {
return Object.values(ROLE).includes(role);
}

0 comments on commit c2be3e7

Please sign in to comment.