Skip to content

Commit

Permalink
fix(Backend): Error on comparing roles , were including final white s…
Browse files Browse the repository at this point in the history
…paces
  • Loading branch information
fabiodmota committed May 9, 2024
1 parent a067612 commit b4b0e14
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ public List<String> getRoles(String clientId){
LinkedHashMap list = (LinkedHashMap) resourceAccess;
LinkedHashMap clientResources = list.get(clientId) != null ? (LinkedHashMap) list.get(clientId):new LinkedHashMap();
List<String> rolesList = clientResources.get("roles") != null ? (List<String>) clientResources.get("roles"):new ArrayList<>();
this.isAdmin = rolesList.contains(VasConstants.CSV_ROLE_COMPANY_ADMIN);

this.isAdmin = rolesList.stream()
.map(String::trim)
.anyMatch(role -> role.equals(VasConstants.CSV_ROLE_COMPANY_ADMIN));

return rolesList;
}

Expand Down

0 comments on commit b4b0e14

Please sign in to comment.