Skip to content

Commit

Permalink
fix: [PROD-11247] make email & roles non-case-sensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
nborde-CSM committed Oct 5, 2023
1 parent d8663ab commit 25ececb
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 @@ -90,7 +90,7 @@ const getPermissionsFromRole = (role, rolesToPermissionsMapping) => {
console.warn("Mapping between roles and permissions is null or undefined, can't retrieve permissions.");
return [];
}
return rolesToPermissionsMapping[role] ?? [];
return rolesToPermissionsMapping[typeof role === 'string' ? role.toLowerCase() : role] ?? [];
};

// Given a permission name and a roles to permissions mapping, this function returns the list of roles granting the
Expand Down Expand Up @@ -129,7 +129,7 @@ const getUserRoleForResource = (resourceSecurity, userIdentifier) => {
if (resourceSecurity.accessControlList != null) {
const acl = resourceSecurity.accessControlList;
if (Array.isArray(acl)) {
const specificUserSecurity = acl.find((aclUser) => aclUser.id === userIdentifier);
const specificUserSecurity = acl.find((aclUser) => aclUser.id.toLowerCase() === userIdentifier.toLowerCase());
if (specificUserSecurity !== undefined) {
return specificUserSecurity.role;
}
Expand Down Expand Up @@ -165,7 +165,7 @@ const _getPermissionsFromMapping = (permissionsMapping) => {
return Array.from(permissionsSet);
};

// Example of format for orgzaniation permissions:
// Example of format for organization permissions:
// [
// {
// component: 'organization',
Expand Down

0 comments on commit 25ececb

Please sign in to comment.