Package org.apache.lenya.ac

Examples of org.apache.lenya.ac.Role


     * Returns the visitor role.
     * @return A role.
     * @throws AccessControlException when something went wrong.
     */
    public static Role getVisitorRole(AccreditableManager manager) throws AccessControlException {
        Role visitorRole = null;
        for (int i = 0; i < VISITOR_ROLES.length; i++) {
            Role role = manager.getRoleManager().getRole(VISITOR_ROLES[i]);
            if (role != null) {
                visitorRole = role;
            }
        }
        return visitorRole;
View Full Code Here


     * Returns the administrator role.
     * @return A role.
     * @throws AccessControlException when something went wrong.
     */
    public static Role getAdministratorRole(AccreditableManager manager) throws AccessControlException {
        Role administratorRole = null;
        for (int i = 0; i < ADMINISTRATOR_ROLES.length; i++) {
            Role role = manager.getRoleManager().getRole(ADMINISTRATOR_ROLES[i]);
            if (role != null) {
                administratorRole = role;
            }
        }
        return administratorRole;
View Full Code Here

     * Returns the author role.
     * @return A role.
     * @throws AccessControlException when something went wrong.
     */
    public static Role getAuthorRole(AccreditableManager manager) throws AccessControlException {
        Role administratorRole = null;
        for (int i = 0; i < AUTHOR_ROLES.length; i++) {
            Role role = manager.getRoleManager().getRole(AUTHOR_ROLES[i]);
            if (role != null) {
                administratorRole = role;
            }
        }
        return administratorRole;
View Full Code Here

        }

        removeAccreditable(manager, accreditable, getPoliciesDirectory());

        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)) {
View Full Code Here

     * @see org.apache.lenya.ac.PolicyManager#accreditableAdded(org.apache.lenya.ac.AccreditableManager, org.apache.lenya.ac.Accreditable)
     */
    public void accreditableAdded(AccreditableManager manager, Accreditable accreditable)
        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

            Element[] roleElements = helper.getChildren(credentialElements[i], ROLE_ELEMENT);

            for (int j = 0; j < roleElements.length; j++) {
                String roleId = roleElements[j].getAttribute(ID_ATTRIBUTE);
                Role role = getAccreditableManager().getRoleManager().getRole(roleId);
                credential.addRole(role);
            }

            policy.addCredential(credential);
        }
View Full Code Here

        }

        removeAccreditable(manager, accreditable, getPoliciesDirectory());

        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)) {
View Full Code Here

     *      org.apache.lenya.ac.Accreditable)
     */
    public void accreditableAdded(AccreditableManager manager, Accreditable accreditable)
            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

        obtainPolicies();
        Set roles = new HashSet();

        // no policies defined: return "visit" or "visitor" role
        if (isEmpty()) {
            Role visitorRole = getVisitorRole(getAccreditableManager());
            if (visitorRole != null) {
                roles.add(visitorRole);
            }
        } else {
            for (int i = 0; i < policies.length; i++) {
View Full Code Here

     * @param manager The accreditable manager.
     * @return A role.
     * @throws AccessControlException when something went wrong.
     */
    public static Role getVisitorRole(AccreditableManager manager) throws AccessControlException {
        Role visitorRole = null;
        for (int i = 0; i < VISITOR_ROLES.length; i++) {
            Role role = manager.getRoleManager().getRole(VISITOR_ROLES[i]);
            if (role != null) {
                visitorRole = role;
            }
        }
        return visitorRole;
View Full Code Here

TOP

Related Classes of org.apache.lenya.ac.Role

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.