private GateResult checkPermission()

in src/main/java/org/apache/sling/jcr/resourcesecurity/impl/ResourceAccessGateFactory.java [91:109]


    private GateResult checkPermission(final ResourceResolver resolver,
            final String path,
            final String permission) {
        boolean granted = false;
        final Session session = resolver.adaptTo(Session.class);
        if ( session != null ) {
            String checkPath = this.jcrPath;
            if ( this.prefix != null && path.startsWith(this.prefix) ) {
                checkPath = this.jcrPath + path.substring(this.prefix.length() - 1);
            }
            try {
                granted = session.hasPermission(checkPath, permission);
            } catch (final RepositoryException re) {
                // ignore
                LOGGER.debug("Could not retrieve permission {} for path {}", checkPath, permission, re);
            }
        }
        return granted ? GateResult.GRANTED : GateResult.DENIED;
    }