Examples of AccessControlEntryImpl


Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlEntryImpl

                ace.getValue().removeAll(removePermissions);
            }

            // create new ACE
            if (!ace.getValue().isEmpty()) {
                newAces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(ace.getKey()),
                        new ArrayList<String>(ace.getValue())));
            }
        }

        // find all ACEs that should be added but are not in the original ACE
        // list
        for (Map.Entry<String, Set<String>> ace : adds.entrySet()) {
            if (!originals.containsKey(ace.getKey()) && !ace.getValue().isEmpty()) {
                newAces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(ace.getKey()),
                        new ArrayList<String>(ace.getValue())));
            }
        }

        return new AccessControlListImpl(newAces);
View Full Code Here

Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlEntryImpl

            for (String s : e.getValue()) {
                permissions.add(s);
            }

            AccessControlEntryImpl ace = new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(e.getKey()),
                    permissions);

            aces.add(ace);
        }
View Full Code Here

Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlEntryImpl

        List<Object> jsonAces = getList(json.get(JSON_ACL_ACES));
        if (jsonAces != null) {
            for (Object obj : jsonAces) {
                Map<String, Object> entry = getMap(obj);
                if (entry != null) {
                    AccessControlEntryImpl ace = new AccessControlEntryImpl();

                    Boolean isDirect = getBoolean(entry, JSON_ACE_IS_DIRECT);
                    ace.setDirect(isDirect != null ? isDirect.booleanValue() : true);

                    List<Object> jsonPermissions = getList(entry.get(JSON_ACE_PERMISSIONS));
                    if (jsonPermissions != null) {
                        List<String> permissions = new ArrayList<String>();
                        for (Object perm : jsonPermissions) {
                            if (perm != null) {
                                permissions.add(perm.toString());
                            }
                        }
                        ace.setPermissions(permissions);
                    }

                    Map<String, Object> jsonPrincipal = getMap(entry.get(JSON_ACE_PRINCIPAL));
                    if (jsonPrincipal != null) {
                        AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl();

                        principal.setId(getString(jsonPrincipal, JSON_ACE_PRINCIPAL_ID));

                        convertExtension(jsonPrincipal, principal, PRINCIPAL_KEYS);

                        ace.setPrincipal(principal);
                    }

                    convertExtension(entry, ace, ACE_KEYS);

                    aces.add(ace);
View Full Code Here

Examples of org.apache.jackrabbit.core.security.authorization.AccessControlEntryImpl

            aclNode = createAclNode(nodePath);
        }
       
        AccessControlEntry[] entries = ((ACLTemplate) policy).getAccessControlEntries();
        for (AccessControlEntry entry : entries) {
            AccessControlEntryImpl ace = (AccessControlEntryImpl) entry;

            Name nodeName = getUniqueNodeName(aclNode, ace.isAllow() ? "allow" : "deny");
            Name ntName = (ace.isAllow()) ? NT_REP_GRANT_ACE : NT_REP_DENY_ACE;
            ValueFactory vf = session.getValueFactory();

            // create the ACE node
            NodeImpl aceNode = addNode(aclNode, nodeName, ntName);

            // write the rep:principalName property
            String principalName = ace.getPrincipal().getName();
            setProperty(aceNode, P_PRINCIPAL_NAME, vf.createValue(principalName));

            // ... and the rep:privileges property
            Privilege[] pvlgs = ace.getPrivileges();
            Value[] names = getPrivilegeNames(pvlgs, vf);
            setProperty(aceNode, P_PRIVILEGES, names);

            // store the restrictions:
            Set<Name> restrNames = ace.getRestrictions().keySet();
            for (Name restrName : restrNames) {
                Value value = ace.getRestriction(restrName);
                setProperty(aceNode, restrName, value);
            }
        }

        // mark the parent modified.
View Full Code Here

Examples of org.apache.jackrabbit.core.security.authorization.AccessControlEntryImpl

        }

        /* add all new entries defined on the template */
        AccessControlEntry[] aces = acl.getAccessControlEntries();
        for (AccessControlEntry ace1 : aces) {
            AccessControlEntryImpl ace = (AccessControlEntryImpl) ace1;

            // create the ACE node
            Name nodeName = getUniqueNodeName(aclNode, "entry");
            Name ntName = (ace.isAllow()) ? NT_REP_GRANT_ACE : NT_REP_DENY_ACE;
            NodeImpl aceNode = addNode(aclNode, nodeName, ntName);

            ValueFactory vf = session.getValueFactory();
            // write the rep:principalName property
            setProperty(aceNode, P_PRINCIPAL_NAME, vf.createValue(ace.getPrincipal().getName()));
            // ... and the rep:privileges property
            Privilege[] privs = ace.getPrivileges();
            Value[] vs = new Value[privs.length];
            for (int j = 0; j < privs.length; j++) {
                vs[j] = vf.createValue(privs[j].getName(), PropertyType.NAME);
            }
            setProperty(aceNode, P_PRIVILEGES, vs);

            // store the restrictions:
            Set<Name> restrNames = ace.getRestrictions().keySet();
            for (Name restrName : restrNames) {
                Value value = ace.getRestriction(restrName);
                setProperty(aceNode, restrName, value);
            }
        }

        // mark the parent modified.
View Full Code Here

Examples of org.apache.jackrabbit.core.security.authorization.AccessControlEntryImpl

           
            // in addition: trivial check if read access is denied somewhere
            canReadAll = canRead(session.getQPath("/"));           
            if (canReadAll) {
                for (AccessControlEntry entry : entries) {
                    AccessControlEntryImpl ace = (AccessControlEntryImpl) entry;
                    if (!ace.isAllow() && ((ace.getPrivilegeBits() & readBits) == readBits)) {
                        // found an ace that defines read deny for a sub tree
                        // -> canReadAll is false.
                        canReadAll = false;
                        break;
                    }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.authorization.AccessControlEntryImpl

            aclNode = createAclNode(nodePath);
        }
       
        AccessControlEntry[] entries = ((ACLTemplate) policy).getAccessControlEntries();
        for (AccessControlEntry entry : entries) {
            AccessControlEntryImpl ace = (AccessControlEntryImpl) entry;

            Name nodeName = getUniqueNodeName(aclNode, ace.isAllow() ? "allow" : "deny");
            Name ntName = (ace.isAllow()) ? NT_REP_GRANT_ACE : NT_REP_DENY_ACE;
            ValueFactory vf = session.getValueFactory();

            // create the ACE node
            NodeImpl aceNode = addNode(aclNode, nodeName, ntName);

            // write the rep:principalName property
            String principalName = ace.getPrincipal().getName();
            setProperty(aceNode, P_PRINCIPAL_NAME, vf.createValue(principalName));

            // ... and the rep:privileges property
            Privilege[] pvlgs = ace.getPrivileges();
            Value[] names = getPrivilegeNames(pvlgs, vf);
            setProperty(aceNode, P_PRIVILEGES, names);

            // store the restrictions:
            Set<Name> restrNames = ace.getRestrictions().keySet();
            for (Name restrName : restrNames) {
                Value value = ace.getRestriction(restrName);
                setProperty(aceNode, restrName, value);
            }
        }

        // mark the parent modified.
View Full Code Here

Examples of org.apache.jackrabbit.core.security.authorization.AccessControlEntryImpl

           
            // in addition: trivial check if read access is denied somewhere
            canReadAll = canRead(session.getQPath("/"));           
            if (canReadAll) {
                for (AccessControlEntry entry : entries) {
                    AccessControlEntryImpl ace = (AccessControlEntryImpl) entry;
                    if (!ace.isAllow() && ((ace.getPrivilegeBits() & readBits) == readBits)) {
                        // found an ace that defines read deny for a sub tree
                        // -> canReadAll is false.
                        canReadAll = false;
                        break;
                    }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.authorization.AccessControlEntryImpl

           
            // in addition: trivial check if read access is denied somewhere
            canReadAll = canRead(session.getQPath("/"));           
            if (canReadAll) {
                for (AccessControlEntry entry : entries) {
                    AccessControlEntryImpl ace = (AccessControlEntryImpl) entry;
                    if (!ace.isAllow() && ace.getPrivilegeBits().includesRead()) {
                        // found an ace that defines read deny for a sub tree
                        // -> canReadAll is false.
                        canReadAll = false;
                        break;
                    }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.authorization.AccessControlEntryImpl

            aclNode = createAclNode(nodePath);
        }
       
        AccessControlEntry[] entries = ((ACLTemplate) policy).getAccessControlEntries();
        for (AccessControlEntry entry : entries) {
            AccessControlEntryImpl ace = (AccessControlEntryImpl) entry;

            Name nodeName = getUniqueNodeName(aclNode, ace.isAllow() ? "allow" : "deny");
            Name ntName = (ace.isAllow()) ? NT_REP_GRANT_ACE : NT_REP_DENY_ACE;
            ValueFactory vf = session.getValueFactory();

            // create the ACE node
            NodeImpl aceNode = addNode(aclNode, nodeName, ntName);

            // write the rep:principalName property
            String principalName = ace.getPrincipal().getName();
            setProperty(aceNode, P_PRINCIPAL_NAME, vf.createValue(principalName));

            // ... and the rep:privileges property
            Privilege[] pvlgs = ace.getPrivileges();
            Value[] names = getPrivilegeNames(pvlgs, vf);
            setProperty(aceNode, P_PRIVILEGES, names);

            // store the restrictions:
            Set<Name> restrNames = ace.getRestrictions().keySet();
            for (Name restrName : restrNames) {
                Value value = ace.getRestriction(restrName);
                setProperty(aceNode, restrName, value);
            }
        }

        // mark the parent modified.
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.