Package org.apache.lenya.ac.impl

Examples of org.apache.lenya.ac.impl.DefaultPolicy


     * @throws ProcessingException when something went wrong.
     */
    public boolean isUrlSSLProtected() throws ProcessingException {
        boolean ssl;
        try {
            DefaultPolicy policy =
                policyManager.buildSubtreePolicy(accessController.getAccreditableManager(), url);
            ssl = policy.isSSLProtected();
        } catch (AccessControlException e) {
            throw new ProcessingException("Resolving policy failed: ", e);
        }
        return ssl;
    }
View Full Code Here


     * @param ssl A boolean value.
     * @throws ProcessingException when something went wrong.
     */
    public void setUrlSSLProtected(boolean ssl) throws ProcessingException {
        try {
            DefaultPolicy policy =
                policyManager.buildSubtreePolicy(accessController.getAccreditableManager(), url);
            policy.setSSL(ssl);
            policyManager.saveSubtreePolicy(url, policy);
        } catch (AccessControlException e) {
            throw new ProcessingException("Resolving policy failed: ", e);
        }
    }
View Full Code Here

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Building policy for URL [" + url + "]");
        }

        DefaultPolicy policy = null;

        String policyUri = getPolicySourceURI(url, policyFilename);
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Policy source URI resolved to: " + policyUri);
        }

        try {
            PolicyBuilder builder = new PolicyBuilder(controller);
            policy = (DefaultPolicy) getCache().get(policyUri, builder);
        } catch (CachingException e) {
            throw new AccessControlException(e);
        }

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Policy exists: [" + (policy != null) + "]");
        }

        if (policy == null) {
            policy = new DefaultPolicy();
        }
        return policy;
    }
View Full Code Here

                    getLogger().debug(
                            "    File:         [" + policyFiles[i].getAbsolutePath() + "]");
                }

                InputStream stream = new FileInputStream(policyFiles[i]);
                DefaultPolicy policy = builder.buildPolicy(stream);
                policy.removeRoles(accreditable);
                savePolicy(policy, policyFiles[i]);
            }
        } catch (Exception e) {
            throw new AccessControlException(e);
        }
View Full Code Here

        if (accreditable instanceof User) {
            Role role = URLPolicy.getAuthorRole(manager);
            if (role != null) {
                String url = USER_ADMIN_URL + ((User) accreditable).getId() + ".html";
                DefaultPolicy policy = buildSubtreePolicy(manager, url);
                Credential credential = policy.getCredential(accreditable);
                if (credential != null && credential.contains(role)) {
                    policy.removeRole(accreditable, role);
                }
                saveSubtreePolicy(url, policy);
            }
        }
    }
View Full Code Here

            throws AccessControlException {
        if (accreditable instanceof User) {
            Role role = URLPolicy.getAuthorRole(manager);
            if (role != null) {
                String url = USER_ADMIN_URL + ((User) accreditable).getId() + ".html";
                DefaultPolicy policy = buildSubtreePolicy(manager, url);
                policy.addRole(accreditable, role);
                saveSubtreePolicy(url, policy);
            }
        }
    }
View Full Code Here

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Building policy for URL [" + url + "]");
        }

        DefaultPolicy policy = null;

        String policyUri = getPolicySourceURI(url, policyFilename);
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Policy source URI resolved to: " + policyUri);
        }

        try {
            PolicyBuilder builder = new PolicyBuilder(controller);
            policy = (DefaultPolicy) getCache().get(policyUri, builder);
        } catch (CachingException e) {
            throw new AccessControlException(e);
        }

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Policy exists: [" + (policy != null) + "]");
        }

        if (policy == null) {
            policy = new DefaultPolicy();
        }
        return policy;
    }
View Full Code Here

                    getLogger().debug(
                            "    File:         [" + policyFiles[i].getAbsolutePath() + "]");
                }

                InputStream stream = new FileInputStream(policyFiles[i]);
                DefaultPolicy policy = builder.buildPolicy(stream);
                policy.removeRoles(accreditable);
                savePolicy(policy, policyFiles[i]);
            }
        } catch (Exception e) {
            throw new AccessControlException(e);
        }
View Full Code Here

        if (accreditable instanceof User) {
            Role role = URLPolicy.getAuthorRole(manager);
            if (role != null) {
                String url = USER_ADMIN_URL + ((User) accreditable).getId() + ".html";
                DefaultPolicy policy = buildSubtreePolicy(manager, url);
                Credential credential = policy.getCredential(accreditable);
                if (credential != null && credential.contains(role)) {
                    policy.removeRole(accreditable, role);
                }
                saveSubtreePolicy(url, policy);
            }
        }
    }
View Full Code Here

            throws AccessControlException {
        if (accreditable instanceof User) {
            Role role = URLPolicy.getAuthorRole(manager);
            if (role != null) {
                String url = USER_ADMIN_URL + ((User) accreditable).getId() + ".html";
                DefaultPolicy policy = buildSubtreePolicy(manager, url);
                policy.addRole(accreditable, role);
                saveSubtreePolicy(url, policy);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.lenya.ac.impl.DefaultPolicy

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.