Source:
<code>public void verifyAccessLayer(String layerName, ReferencedEnvelope boundingBox) throws ServiceException { LayerInfo layerInfo = getLayerInfoByName(layerName); if (layerInfo == null) { throw new ServiceException("Could not find layer " + layerName, "LayerNotDefined"); } if (layerInfo instanceof SecuredLayerInfo && boundingBox != null) { SecuredLayerInfo securedLayerInfo = (SecuredLayerInfo) layerInfo; WrapperPolicy policy = securedLayerInfo.getWrapperPolicy(); AccessLimits limits = policy.getLimits(); if (limits instanceof DataAccessLimits) { Filter filter = ((DataAccessLimits) limits).getReadFilter(); <START> if (filter != null) { <END> Envelope limitBox = (Envelope) filter.accept(ExtractBoundsFilterVisitor.BOUNDS_VISITOR, null); if (limitBox != null) { CoordinateReferenceSystem dataCrs = layerInfo.getResource().getCRS(); limitBox = new ReferencedEnvelope(limitBox, dataCrs); if (boundingBox.getCoordinateReferenceSystem()!=null && !CRS.equalsIgnoreMetadata(dataCrs, boundingBox.getCoordinateReferenceSystem())) { try { boundingBox = boundingBox.transform(dataCrs,true); } catch (Exception e) { boundingBox = null; } } if (boundingBox==null || !limitBox.contains(boundingBox)) { throw new ServiceException("Access denied to bounding box on layer " + layerName, "AccessDenied"); } } } } } }</code><technical_language>code stop here. If is a filter is Filter.INCLUDE contents of tile different, empty, a consideration: - filter geographic (maybe types of buildings visible users) - a WMS request area is allowed throw exception, simply return a blank So, right filter wise: - if filter is missing INCLUDE, return cached tiles is - if filter is EXCLUDE, build a blank tile return caching - in other case, filter turned a request parameter generation of a separate tile cache for specific filter (maybe hash it, turn a CQL_FILTER for example GWC machinery deal it) Also, DataAccessLimit is filter data. CoverageAccessLimits WMSAccessLimits do a rasterFilter, a MultiPolygon, is cut imagery, this consideration well, I logic (fully polygon, normal tile, fully outside, blank, border, create a parameter induces a separate tile cache)</technical_language>

Target:
public void verifyAccessLayer(String layerName, ReferencedEnvelope boundingBox) throws ServiceException { LayerInfo layerInfo = getLayerInfoByName(layerName); if (layerInfo == null) { throw new ServiceException("Could not find layer " + layerName, "LayerNotDefined"); } if (layerInfo instanceof SecuredLayerInfo && boundingBox != null) { SecuredLayerInfo securedLayerInfo = (SecuredLayerInfo) layerInfo; WrapperPolicy policy = securedLayerInfo.getWrapperPolicy(); AccessLimits limits = policy.getLimits(); if (limits instanceof DataAccessLimits) { CoordinateReferenceSystem dataCrs = layerInfo.getResource().getCRS(); if (boundingBox.getCoordinateReferenceSystem()!=null && !CRS.equalsIgnoreMetadata(dataCrs, boundingBox.getCoordinateReferenceSystem())) { try { boundingBox = boundingBox.transform(dataCrs,true); } catch (Exception e) { boundingBox = null; } } Envelope limitBox = new ReferencedEnvelope(ReferencedEnvelope.EVERYTHING, dataCrs); Filter filter = ((DataAccessLimits) limits).getReadFilter(); if (filter != null) { Envelope box = (Envelope) filter.accept(ExtractBoundsFilterVisitor.BOUNDS_VISITOR, null); if (box != null) { limitBox = new ReferencedEnvelope(limitBox.intersection(box), dataCrs); } } if (limits instanceof CoverageAccessLimits) { if (((CoverageAccessLimits) limits).getRasterFilter() != null) { Envelope box = ((CoverageAccessLimits) limits).getRasterFilter().getEnvelopeInternal(); if (box != null) { limitBox = new ReferencedEnvelope(limitBox.intersection(box), dataCrs); } } } if (limits instanceof WMSAccessLimits) { if (((WMSAccessLimits) limits).getRasterFilter() != null) { Envelope box = ((WMSAccessLimits) limits).getRasterFilter().getEnvelopeInternal(); if (box != null) { limitBox = new ReferencedEnvelope(limitBox.intersection(box), dataCrs); } } } if (!limitBox.covers(ReferencedEnvelope.EVERYTHING) && (boundingBox==null || !limitBox.contains(boundingBox))) { throw new ServiceException("Access denied to bounding box on layer " + layerName, "AccessDenied"); } } } }