Skip to content

Commit

Permalink
[feature/#323] spotlessJavaApply
Browse files Browse the repository at this point in the history
  • Loading branch information
whitem4rk committed Jun 26, 2024
1 parent 82f1582 commit fae27df
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import java.util.Set;
import java.util.stream.Collectors;

import javax.persistence.EntityNotFoundException;

import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -102,13 +102,11 @@ public boolean checkMenuAccess(Integer menuId, String action) {
break;
}

Set<String> prefixedRoles = requiredRoles.stream()
.map(role -> ROLE_PREFIX + role)
.collect(Collectors.toSet());
Set<String> prefixedRoles =
requiredRoles.stream().map(role -> ROLE_PREFIX + role).collect(Collectors.toSet());

boolean hasAuthority = authorities.stream()
.map(GrantedAuthority::getAuthority)
.anyMatch(prefixedRoles::contains);
boolean hasAuthority =
authorities.stream().map(GrantedAuthority::getAuthority).anyMatch(prefixedRoles::contains);

if (!hasAuthority) {
throw new InvalidAuthorityException();
Expand Down

0 comments on commit fae27df

Please sign in to comment.