Package javax.jcr.security

Examples of javax.jcr.security.AccessControlPolicy


        SessionImpl s = (SessionImpl) n.getSession();
        JackrabbitAccessControlList acl = null;
        AccessControlManager acMgr = s.getAccessControlManager();
        AccessControlPolicyIterator it = acMgr.getApplicablePolicies(n.getPath());
        while (it.hasNext()) {
            AccessControlPolicy acp = it.nextAccessControlPolicy();
            if (acp instanceof JackrabbitAccessControlList) {
                acl = (JackrabbitAccessControlList) acp;
                break;
            }
        }
View Full Code Here


        checkValidPolicy(nodePath, policy);

        NodeImpl acNode = getAcNode(nodePath);
        if (isAccessControlled(acNode)) {
            // build the template in order to have a return value
            AccessControlPolicy tmpl = createTemplate(acNode);
            if (tmpl.equals(policy)) {
                removeItem(acNode.getNode(N_POLICY));
                return;
            }
        }
        // node either not access-controlled or the passed policy didn't apply
View Full Code Here

            // ok.
        }

        /* Finally the test user must not be allowed to remove the policy. */
        try {
            testAcMgr.removePolicy(path, new AccessControlPolicy() {});
            fail("Test user must not be allowed to remove the access control policy.");
        } catch (AccessDeniedException e) {
            // success
        }
    }
View Full Code Here

            fail("test user must not have READ_AC privilege.");
        } catch (AccessDeniedException e) {
            // success
        }
        try {
            testAcMgr.removePolicy(tmpl.getPath(), new AccessControlPolicy() {});
            fail("test user must not have MODIFY_AC privilege.");
        } catch (AccessDeniedException e) {
            // success
        }
    }
View Full Code Here

     * @see AccessControlEditor#editAccessControlPolicies(String)
     */
    public AccessControlPolicy[] editAccessControlPolicies(String nodePath) throws AccessControlException, PathNotFoundException, RepositoryException {
        checkProtectsNode(nodePath);

        AccessControlPolicy acl = null;
        NodeImpl controlledNode = getNode(nodePath);
        NodeImpl aclNode = getAclNode(controlledNode);
        if (aclNode == null) {
            // create an empty acl unless the node is protected or cannot have
            // rep:AccessControllable mixin set (e.g. due to a lock)
View Full Code Here

        checkValidPolicy(nodePath, policy);

        NodeImpl acNode = getAcNode(nodePath);
        if (isAccessControlled(acNode)) {
            // build the template in order to have a return value
            AccessControlPolicy tmpl = createTemplate(acNode);
            if (tmpl.equals(policy)) {
                removeItem(acNode.getNode(N_POLICY));
                return;
            }
        }
        // node either not access-controlled or the passed policy didn't apply
View Full Code Here

        SessionImpl s = (SessionImpl) n.getSession();
        JackrabbitAccessControlList acl = null;
        AccessControlManager acMgr = s.getAccessControlManager();
        AccessControlPolicyIterator it = acMgr.getApplicablePolicies(n.getPath());
        while (it.hasNext()) {
            AccessControlPolicy acp = it.nextAccessControlPolicy();
            if (acp instanceof JackrabbitAccessControlList) {
                acl = (JackrabbitAccessControlList) acp;
                break;
            }
        }
View Full Code Here

    }

    private static AccessControlList getList(AccessControlManager acMgr, String path)
            throws NotExecutableException, AccessDeniedException, RepositoryException {
        for (AccessControlPolicyIterator it = acMgr.getApplicablePolicies(path); it.hasNext();) {
            AccessControlPolicy acp = it.nextAccessControlPolicy();
            if (acp instanceof AccessControlList) {
                return (AccessControlList) acp;
            }
        }
        AccessControlPolicy[] acps = acMgr.getPolicies(path);
View Full Code Here

            assertEquals(0, effective.length);

            AccessControlPolicyIterator it = acMgr.getApplicablePolicies(null);
            assertNotNull(it);
            assertTrue(it.hasNext());
            AccessControlPolicy acp = it.nextAccessControlPolicy();
            assertNotNull(acp);
            assertTrue(acp instanceof JackrabbitAccessControlPolicy);

            // modify the repo level policy
            modifyPrivileges(null, NameConstants.JCR_NODE_TYPE_DEFINITION_MANAGEMENT.toString(), false);
View Full Code Here

        AccessControlPolicyIterator itr = acMgr.getApplicablePolicies(testPath);

        assertNotNull(itr);
        assertTrue(itr.hasNext());

        AccessControlPolicy policy = itr.nextAccessControlPolicy();
        assertNotNull(policy);
        assertTrue(policy instanceof ACL);

        ACL acl = (ACL) policy;
        assertTrue(acl.isEmpty());
View Full Code Here

TOP

Related Classes of javax.jcr.security.AccessControlPolicy

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.