Skip to content

Commit

Permalink
Refactored SecurityService
Browse files Browse the repository at this point in the history
  • Loading branch information
ScarletRedMan committed Mar 26, 2024
1 parent 8ccb1ed commit f41b5dc
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public void logout() {

public boolean hasRole(String role) {
var r = "ROLE_" + role;
return getAuthenticatedAccount().getAuthorities().stream().anyMatch(permission -> r.equals(permission.getAuthority()));
for (var permission: getAuthenticatedAccount().getAuthorities()) {
if (r.equals(permission.getAuthority())) return true;
}
return false;
}
}

0 comments on commit f41b5dc

Please sign in to comment.