/** * Check the visibility of a configured entity. * * @param configured * The requested configured entity. * @param <K> * The {@link Configurable} identifier type. * @param <T> * The {@link Configurable} type. * @return The formal entity parameter. */ protected <K extends Serializable, T extends Configurable<C, K>> T checkConfiguredVisibility(final T configured) { final Subscription entity = subscriptionRepository .findOneExpected(configured.getConfiguration().getSubscription().getId()); if (projectRepository.findOneVisible(entity.getProject().getId(), securityHelper.getLogin()) == null) { // Associated project is not visible, reject the configuration access throw new EntityNotFoundException(configured.getId().toString()); } return configured; }