Package org.apache.jackrabbit.oak.spi.security.authorization

Examples of org.apache.jackrabbit.oak.spi.security.authorization.ACE


                return (ace != null) && ace.getPrincipal().equals(principal);
            }
        }));

        for (JackrabbitAccessControlEntry ace : subList) {
            ACE existing = (ACE) ace;
            PrivilegeBits existingBits = getPrivilegeBits(existing);
            PrivilegeBits entryBits = getPrivilegeBits(entry);
            if (entry.getRestrictions().equals(existing.getRestrictions())) {
                if (isRedundantOrExtending(existing, entry)) {
                    if (existingBits.includes(entryBits)) {
                        return false;
                    } else {
                        // merge existing and new ace
View Full Code Here


        return existing.isAllow() == entry.isAllow()
                && (!(existing.getPrincipal() instanceof Group) || entries.indexOf(existing) == entries.size() - 1);
    }

    private ACE createACE(ACE existing, PrivilegeBits newPrivilegeBits) throws RepositoryException {
        return new ACE(existing.getPrincipal(), getPrivileges(newPrivilegeBits), existing.isAllow(), existing.getRestrictions());
    }
View Full Code Here

    private JackrabbitAccessControlEntry createACE(@Nullable String oakPath,
                                                   @Nonnull Tree aceTree,
                                                   @Nonnull RestrictionProvider restrictionProvider) throws RepositoryException {
        boolean isAllow = NT_REP_GRANT_ACE.equals(TreeUtil.getPrimaryTypeName(aceTree));
        Set<Restriction> restrictions = restrictionProvider.readRestrictions(oakPath, aceTree);
        return new ACE(getPrincipal(aceTree), getPrivileges(aceTree), isAllow, restrictions);
    }
View Full Code Here

            rs = new HashSet<Restriction>(restrictions.size());
            for (String name : restrictions.keySet()) {
                rs.add(getRestrictionProvider().createRestriction(getOakPath(), name, restrictions.get(name)));
            }
        }
        JackrabbitAccessControlEntry entry = new ACE(principal, privileges, isAllow, rs);
        if (entries.contains(entry)) {
            log.debug("Entry is already contained in policy -> no modification.");
            return false;
        } else {
            return entries.add(entry);
View Full Code Here

    private JackrabbitAccessControlEntry createACE(String oakPath, Tree aceTree,
                                                   RestrictionProvider restrictionProvider) throws RepositoryException {
        NodeUtil aceNode = new NodeUtil(aceTree);
        boolean isAllow = aceNode.hasPrimaryNodeTypeName(NT_REP_GRANT_ACE);
        Set<Restriction> restrictions = restrictionProvider.readRestrictions(oakPath, aceTree);
        return new ACE(getPrincipal(aceNode), getPrivileges(aceNode), isAllow, restrictions);
    }
View Full Code Here

    }

    @Test
    public void testRemoveNonExisting() throws Exception {
        try {
            emptyAcl.removeAccessControlEntry(new ACE(testPrincipal, testPrivileges, true, null));
            fail("Removing a non-existing ACE should fail.");
        } catch (AccessControlException e) {
            // success
        }
    }
View Full Code Here

        Privilege[] write = privilegesFromNames(PrivilegeConstants.JCR_WRITE);

        emptyAcl.addAccessControlEntry(testPrincipal, read);
        emptyAcl.addAccessControlEntry(getTestPrincipal("p2"), write);

        AccessControlEntry invalid = new ACE(testPrincipal, write, false, Collections.<Restriction>emptySet());
        try {
            emptyAcl.orderBefore(invalid, emptyAcl.getEntries().get(0));
            fail("src entry not contained in list -> reorder should fail.");
        } catch (AccessControlException e) {
            // success
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.spi.security.authorization.ACE

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.