@Override
    public ApiVersionBeanDto getApiVersion(String organizationId, String apiId, String version)
        throws ApiVersionNotFoundException {

        securityContext.checkPermissionsOrDiscoverability(
                API,
                organizationId,
                apiId,
                version,
                Set.of(PermissionType.apiView)
        );

        if (securityContext.hasPermission(PermissionType.apiView, organizationId)) {
            return apiService.getApiVersion(organizationId, apiId, version);
        } else {
            ApiVersionBeanDto av = apiService.getApiVersion(organizationId, apiId, version);
            Set<ApiPlanBeanDto> filteredPlans = av.getPlans().stream()
                    .filter(avp -> securityContext.getPermittedDiscoverabilities().contains(avp.getDiscoverability()))
                    .collect(Collectors.toSet());
            av.setPlans(filteredPlans);
            return av;
        }
    }
REST layer for Organization

TODO(msavy): split this into multiple interfaces & impls (ApiResource, ClientAppResource, etc).

@author eric.wittmann@redhat.com
@author marc@blackparrotlabs.io
manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/OrganizationResourceImpl.java