Package org.apache.sling.api.security

Examples of org.apache.sling.api.security.ResourceAccessSecurity


    public boolean canCreate(final ResourceResolverContext ctx, final ResourceResolver resolver, final String path) {
        final ResourceAccessSecurityTracker tracker = ctx.getResourceAccessSecurityTracker();
        boolean allowed = true;
        if ( useResourceAccessSecurity ) {
            final ResourceAccessSecurity security = tracker.getProviderResourceAccessSecurity();
            if ( security != null ) {
                allowed = security.canCreate(path, resolver);
            } else {
                allowed = false;
            }
        }

        if ( allowed ) {
            final ResourceAccessSecurity security = tracker.getApplicationResourceAccessSecurity();
            if (security != null) {
                allowed = security.canCreate(path, resolver);
            }
        }
        return allowed;
    }
View Full Code Here


    public boolean canDelete(final ResourceResolverContext ctx, final Resource resource) {
        final ResourceAccessSecurityTracker tracker = ctx.getResourceAccessSecurityTracker();
        boolean allowed = true;
        if ( useResourceAccessSecurity ) {
            final ResourceAccessSecurity security = tracker.getProviderResourceAccessSecurity();
            if ( security != null ) {
                allowed = security.canDelete(resource);
            } else {
                allowed = false;
            }
        }

        if ( allowed ) {
            final ResourceAccessSecurity security = tracker.getApplicationResourceAccessSecurity();
            if (security != null) {
                allowed = security.canDelete(resource);
            }
        }
        return allowed;
    }
View Full Code Here

        final ResourceAccessSecurityTracker tracker = ctx.getResourceAccessSecurityTracker();

        Resource returnValue = null;

        if (useResourceAccessSecurity && resource != null) {
            final ResourceAccessSecurity resourceAccessSecurity = tracker.getProviderResourceAccessSecurity();
            if (resourceAccessSecurity != null) {
                returnValue = resourceAccessSecurity.getReadableResource(resource);
            }
        } else {
            returnValue = resource;
        }

        if ( returnValue != null ) {
            final ResourceAccessSecurity resourceAccessSecurity = tracker.getApplicationResourceAccessSecurity();
            if (resourceAccessSecurity != null) {
                returnValue = resourceAccessSecurity.getReadableResource(returnValue);
            }
        }

        return returnValue;
    }
View Full Code Here

        final ResourceAccessSecurityTracker tracker = ctx.getResourceAccessSecurityTracker();

        String returnValue = query;

        if (useResourceAccessSecurity) {
            final ResourceAccessSecurity resourceAccessSecurity = tracker
                    .getProviderResourceAccessSecurity();
            if (resourceAccessSecurity != null) {
                try {
                    returnValue = resourceAccessSecurity.transformQuery(
                            returnValue, language, resolver);
                } catch (AccessSecurityException e) {
                    logger.error(
                            "AccessSecurityException occurred while trying to transform the query {} (language {}).",
                            new Object[] { query, language }, e);
                }
            }
        }

        final ResourceAccessSecurity resourceAccessSecurity = tracker
                .getApplicationResourceAccessSecurity();
        if (resourceAccessSecurity != null) {
            try {
                returnValue = resourceAccessSecurity.transformQuery(
                        returnValue, language, resolver);
            } catch (AccessSecurityException e) {
                logger.error(
                        "AccessSecurityException occurred while trying to transform the query {} (language {}).",
                        new Object[] { query, language }, e);
View Full Code Here

TOP

Related Classes of org.apache.sling.api.security.ResourceAccessSecurity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.