Package org.apache.chemistry.opencmis.commons.data

Examples of org.apache.chemistry.opencmis.commons.data.Acl


    private void handleAclModifications(String repositoryId, AtomEntry entry, Acl addAces, Acl removeAces) {
        if (!isAclMergeRequired(addAces, removeAces)) {
            return;
        }

        Acl originalAces = null;

        // walk through the entry and find the current ACL
        for (AtomElement element : entry.getElements()) {
            if (element.getObject() instanceof CmisObjectType) {
                // extract current ACL
                CmisObjectType object = (CmisObjectType) element.getObject();
                originalAces = convert(object.getAcl(), object.isExactACL());

                break;
            }
        }

        if (originalAces != null) {
            // merge and update ACL
            Acl newACL = mergeAcls(originalAces, addAces, removeAces);
            if (newACL != null) {
                updateAcl(repositoryId, entry.getId(), newACL, null);
            }
        }
    }
View Full Code Here


        String objectId = getObjectId();
        return getBinding().getAclService().getAcl(getRepositoryId(), objectId, onlyBasicPermissions, null);
    }

    public Acl applyAcl(List<Ace> addAces, List<Ace> removeAces, AclPropagation aclPropagation) {
        Acl result = getSession().applyAcl(this, addAces, removeAces, aclPropagation);

        refresh();

        return result;
    }
View Full Code Here

    }

    public Acl createAcl(List<Ace> aces) {
        BindingsObjectFactory bof = getBindingsObjectFactory();

        Acl acl = bof.createAccessControlList(aces);

        return acl;
    }
View Full Code Here

        ChangeType changeType = null;
        GregorianCalendar changeTime = null;
        String objectId = null;
        Map<String, List<?>> properties = null;
        List<String> policyIds = null;
        Acl acl = null;

        if (objectData.getChangeEventInfo() != null) {
            changeType = objectData.getChangeEventInfo().getChangeType();
            changeTime = objectData.getChangeEventInfo().getChangeTime();
        }
View Full Code Here

        }

        // set object id
        objectId.setValue(entry.getId());

        Acl originalAces = null;

        lockLinks();
        try {
            // clean up cache
            removeLinks(repositoryId, entry.getId());

            // walk through the entry
            for (AtomElement element : entry.getElements()) {
                if (element.getObject() instanceof AtomLink) {
                    addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
                } else if (element.getObject() instanceof CmisObjectType) {
                    // extract current ACL
                    object = (CmisObjectType) element.getObject();
                    originalAces = convert(object.getAcl(), object.isExactACL());
                }
            }
        } finally {
            unlockLinks();
        }

        // handle ACL modifications
        if ((originalAces != null) && (isAclMergeRequired(addAces, removeAces))) {
            // merge and update ACL
            Acl newACL = mergeAcls(originalAces, addAces, removeAces);
            if (newACL != null) {
                updateAcl(repositoryId, entry.getId(), newACL, null);
            }
        }
    }
View Full Code Here

        setSession(session);
    }

    public Acl applyAcl(String repositoryId, String objectId, Acl addAces, Acl removeAces,
            AclPropagation aclPropagation, ExtensionsData extension) {
        Acl result = null;

        // fetch the current ACL
        Acl originalAces = getAcl(repositoryId, objectId, false, null);

        // if no changes required, just return the ACL
        if (!isAclMergeRequired(addAces, removeAces)) {
            return originalAces;
        }

        // merge ACLs
        Acl newACL = mergeAcls(originalAces, addAces, removeAces);

        // update ACL
        AtomAcl acl = updateAcl(repositoryId, objectId, newACL, aclPropagation);
        result = convert(acl.getACL(), null);
View Full Code Here

        // apply an ACL
        if (supportsManageACLs()) {
            Ace ace = getObjectFactory()
                    .createAccessControlEntry(getUsername(), Collections.singletonList("cmis:read"));
            Acl acl = getObjectFactory().createAccessControlList(Collections.singletonList(ace));

            Acl newAcl = getBinding().getAclService().applyAcl(getTestRepositoryId(), docId, acl, null,
                    getAclPropagation(), null);
            assertNotNull(newAcl);

            Acl readAcl = getBinding().getAclService().getAcl(getTestRepositoryId(), docId, Boolean.FALSE, null);
            assertNotNull(readAcl);

            assertEquals(newAcl, readAcl);
        } else {
            warning("ACLs management not supported!");
View Full Code Here

        // get document for id
        Document doc = (Document) this.session.getObject(id);
        assertNotNull(doc);

        // apply acl (not supported by InMemory?)
        Acl acl = doc.applyAcl(aces, null, AclPropagation.PROPAGATE);
        assertNotNull(acl);

        // read & check acls
         Acl acl2 = doc.getAcl();
         assertNotNull(acl2);

        /*
         * Session 2
         */

        // get document for id
        Document doc2 = (Document) this.session2.getObject(id);
        assertNotNull(doc2);

        // read properties (required to reproduce the bug)
        List<Property<?>> pl2 = doc2.getProperties();
        assertNotNull(pl2);

        // read & check acls
        Acl acl3 = doc2.getAcl();
        assertNotNull(acl3);

    }
View Full Code Here

    protected String createDocumentNoCatch(String name, String folderId, String typeId, VersioningState versioningState,
            boolean withContent) {
        ContentStream contentStream = null;
        List<String> policies = null;
        Acl addACEs = null;
        Acl removeACEs = null;
        ExtensionsData extension = null;

        Properties props = createDocumentProperties(name, typeId);

        if (withContent)
View Full Code Here

            throws CmisException {
        CmisService service = null;
        try {
            service = getService(wsContext, repositoryId);

            Acl acl = service.applyAcl(repositoryId, objectId, convert(addAces, null), convert(removeAces, null),
                    convert(AclPropagation.class, aclPropagation), convert(extension));

            if (acl == null) {
                return null;
            }

            CmisACLType result = new CmisACLType();
            result.setACL(convert(acl));
            result.setExact(acl.isExact());

            return result;
        } catch (Exception e) {
            throw convertException(e);
        } finally {
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.data.Acl

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.