Package org.apache.lenya.ac

Examples of org.apache.lenya.ac.Role


        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

     * @param manager The accreditable manager.
     * @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

     * @param manager The accreditable manager.
     * @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

        File configDir = getAccreditablesDirectory();
        String name = "test";
        FileRoleManager manager = null;
        manager = FileRoleManager.instance(configDir);
        assertNotNull(manager);
        Role role = new FileRole(manager.getConfigurationDirectory(), name);
        manager.add(role);

        assertTrue(manager.getRoles().length > 0);
    }
View Full Code Here

   *
   */
    final public void testRemoveRole() throws AccessControlException {
        File configDir = getAccreditablesDirectory();
        String name = "test2";
        Role role = new FileRole(configDir, name);
        FileRoleManager manager = null;

        try {
            manager = FileRoleManager.instance(configDir);
        } catch (AccessControlException e) {
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

           
            boolean complied = false;
           
            for (Iterator i = this.roleIds.iterator(); i.hasNext(); ) {
                String roleId = (String) i.next();
                Role role = roleManager.getRole(roleId);
                if (policy.check(identity, role) == Policy.RESULT_GRANTED) {
                    complied = true;
                }
            }
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.