boolean hasAccessRightsForFeature(String feature) { Set<String> grantedRoles = kieACL.getGrantedRoles(feature); if (sessionInfo != null && sessionInfo.getIdentity() != null && sessionInfo.getIdentity().getRoles() != null) { for (Role role : sessionInfo.getIdentity().getRoles()) { if (grantedRoles.contains(role.getName())) { return true; } } } return false; }
private List<Menus> getRoles() { final List<Menus> result = new ArrayList<Menus>(identity.getRoles().size()); result.add( MenuFactory.newSimpleItem(constants.LogOut()) .respondsWith(new LogoutCommand()) .endMenu() .build()); for (final Role role : identity.getRoles()) { if (!role.getName().equals("IS_REMEMBER_ME")) { result.add( MenuFactory.newSimpleItem(constants.Role() + ": " + role.getName()).endMenu().build()); } } return result; }
private void setSourceEditionGrant() { Set<String> grantedRoles = kieACL.getGrantedRoles(DataModelerFeatures.EDIT_SOURCES); sourceEditionEnabled = false; if (sessionInfo != null && sessionInfo.getIdentity() != null && sessionInfo.getIdentity().getRoles() != null) { for (Role role : sessionInfo.getIdentity().getRoles()) { if (grantedRoles.contains(role.getName())) { sourceEditionEnabled = true; break; } } } }