use of org.togetherjava.tjbot.logwatcher.accesscontrol.AllowedRoles in project TJ-Bot by Together-Java.
the class MainLayout method checkAccess.
private boolean checkAccess(MenuItemInfo menuItemInfo) {
final Class<? extends Component> view = menuItemInfo.view;
final AllowedRoles annotation = view.getAnnotation(AllowedRoles.class);
if (annotation == null) {
logger.warn("Class {} not properly secured with Annotation", view);
return false;
}
final Set<Role> roles = Set.of(annotation.roles());
return !Sets.intersection(this.authenticatedUser.getRoles(), roles).isEmpty();
}
Aggregations