Examples of addAccessControlEntry()


Examples of javax.jcr.security.AccessControlList.addAccessControlEntry()

    public void testRemoveAccessControlEntryIsTransient() throws NotExecutableException, RepositoryException {
        checkCanModifyAc(path);

        AccessControlList acl = getList(acMgr, path);
        // make sure an ACE is present and modifications are persisted.
        if (acl.addAccessControlEntry(testPrincipal, privs)) {
            acMgr.setPolicy(path, acl);
            superuser.save();
        } else {
            throw new NotExecutableException();
        }
View Full Code Here

Examples of javax.jcr.security.AccessControlList.addAccessControlEntry()

    }

    public void testAddAccessControlEntryTwice() throws NotExecutableException, RepositoryException {
        checkCanModifyAc(path);
        AccessControlList acl = getList(acMgr, path);
        if (acl.addAccessControlEntry(testPrincipal, privs)) {
            assertFalse("Adding the same ACE twice should not modify the AC-List.",
                    acl.addAccessControlEntry(testPrincipal, privs));
        }
    }
View Full Code Here

Examples of javax.jcr.security.AccessControlList.addAccessControlEntry()

    public void testAddAccessControlEntryTwice() throws NotExecutableException, RepositoryException {
        checkCanModifyAc(path);
        AccessControlList acl = getList(acMgr, path);
        if (acl.addAccessControlEntry(testPrincipal, privs)) {
            assertFalse("Adding the same ACE twice should not modify the AC-List.",
                    acl.addAccessControlEntry(testPrincipal, privs));
        }
    }

    public void testAddAccessControlEntryAgain() throws NotExecutableException, RepositoryException {
        checkCanModifyAc(path);
View Full Code Here

Examples of javax.jcr.security.AccessControlList.addAccessControlEntry()

    public void testAddAccessControlEntryAgain() throws NotExecutableException, RepositoryException {
        checkCanModifyAc(path);

        AccessControlList list = getList(acMgr, path);
        list.addAccessControlEntry(testPrincipal, privs);
        AccessControlEntry[] entries = list.getAccessControlEntries();
        if (entries.length > 0) {
            assertFalse("Adding an existing entry again must not modify the AC-List",
                    list.addAccessControlEntry(entries[0].getPrincipal(), entries[0].getPrivileges()));
        } else {
View Full Code Here

Examples of javax.jcr.security.AccessControlList.addAccessControlEntry()

        AccessControlList list = getList(acMgr, path);
        list.addAccessControlEntry(testPrincipal, privs);
        AccessControlEntry[] entries = list.getAccessControlEntries();
        if (entries.length > 0) {
            assertFalse("Adding an existing entry again must not modify the AC-List",
                    list.addAccessControlEntry(entries[0].getPrincipal(), entries[0].getPrivileges()));
        } else {
            throw new NotExecutableException();
        }
    }
View Full Code Here

Examples of javax.jcr.security.AccessControlList.addAccessControlEntry()

        }

        AccessControlList acl = getList(acMgr, path);
        Privilege privilege = (Privilege) twoPrivs.get(0);
        // add first privilege:
        acl.addAccessControlEntry(testPrincipal, new Privilege[] {privilege});

        // add a second privilege (but not specifying the privilege added before)
        // -> the first privilege must not be removed.
        Privilege privilege2 = (Privilege) twoPrivs.get(1);
        acl.addAccessControlEntry(testPrincipal, new Privilege[] {privilege2});
View Full Code Here

Examples of javax.jcr.security.AccessControlList.addAccessControlEntry()

        acl.addAccessControlEntry(testPrincipal, new Privilege[] {privilege});

        // add a second privilege (but not specifying the privilege added before)
        // -> the first privilege must not be removed.
        Privilege privilege2 = (Privilege) twoPrivs.get(1);
        acl.addAccessControlEntry(testPrincipal, new Privilege[] {privilege2});

        List currentPrivileges = currentPrivileges(acl, testPrincipal);
        assertTrue("'AccessControlList.addAccessControlEntry' must not remove privileges added before", currentPrivileges.containsAll(twoPrivs));
    }
}
View Full Code Here

Examples of org.apache.jackrabbit.api.jsr283.security.AccessControlList.addAccessControlEntry()

          newPrivileges.append(privilege.getName());
        }
      }
      if (grantedPrivilegeList.size() > 0) {
        Principal principal = authorizable.getPrincipal();
        updatedAcl.addAccessControlEntry(principal, grantedPrivilegeList.toArray(new Privilege[grantedPrivilegeList.size()]));
      }

      //if the authorizable is a user (not a group) process any denied privileges
      if (!authorizable.isGroup()) {
        //add a fresh ACE with the denied privileges
View Full Code Here

Examples of org.apache.jackrabbit.api.security.JackrabbitAccessControlList.addAccessControlEntry()

    @Test
    public void testDuplicateAce() throws Exception {
        AccessControlManager acMgr = getAccessControlManager(root);
        JackrabbitAccessControlList acl = org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils.getAccessControlList(acMgr, testPath);
        acl.addAccessControlEntry(testPrincipal, privilegesFromNames(PrivilegeConstants.JCR_ADD_CHILD_NODES));
        acMgr.setPolicy(testPath, acl);

        // add duplicate ac-entry on OAK-API
        NodeUtil policy = new NodeUtil(root.getTree(testPath + "/rep:policy"));
        NodeUtil ace = policy.addChild("duplicateAce", NT_REP_GRANT_ACE);
View Full Code Here

Examples of org.apache.jackrabbit.api.security.JackrabbitAccessControlList.addAccessControlEntry()

        NodeUtil testNode = rootNode.addChild("testPath", JcrConstants.NT_UNSTRUCTURED);
        testNode.addChild("childNode", JcrConstants.NT_UNSTRUCTURED);

        AccessControlManager acMgr = getAccessControlManager(root);
        JackrabbitAccessControlList acl = AccessControlUtils.getAccessControlList(acMgr, testPath);
        acl.addAccessControlEntry(testPrincipal, privilegesFromNames(JCR_ADD_CHILD_NODES));
        acl.addAccessControlEntry(EveryonePrincipal.getInstance(), privilegesFromNames(JCR_READ));
        acMgr.setPolicy(testPath, acl);
        root.commit();

        testPrincipalName = testPrincipal.getName();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.