Refactored SecurityService
This commit is contained in:
parent
8ccb1ed44d
commit
f41b5dc5a0
@ -28,6 +28,9 @@ public class SecurityService {
|
|||||||
|
|
||||||
public boolean hasRole(String role) {
|
public boolean hasRole(String role) {
|
||||||
var r = "ROLE_" + 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user