Skip to content

Commit

Permalink
Merge pull request #175 from eclipse-tractusx/fix/roles-trim
Browse files Browse the repository at this point in the history
Error on comparing roles
  • Loading branch information
fabiodmota authored May 9, 2024
2 parents a067612 + b4b0e14 commit c0f9d47
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 c0f9d47

Please sign in to comment.