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

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


    private String createDocumentWithCustomType(String folderId, boolean withContent) {
        ContentStream contentStream = null;
        VersioningState versioningState = VersioningState.NONE;
        List<String> policies = null;
        Acl addACEs = null;
        Acl removeACEs = null;
        ExtensionsData extension = null;

        // create the properties:
        List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
        properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, MY_CUSTOM_NAME));
View Full Code Here


    private String createDocumentInheritedProperties(String folderId, boolean withContent) {
        ContentStream contentStream = null;
        VersioningState versioningState = VersioningState.NONE;
        List<String> policies = null;
        Acl addACEs = null;
        Acl removeACEs = null;
        ExtensionsData extension = null;

        // create the properties:
        List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
        properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, MY_CUSTOM_NAME));
View Full Code Here

    /**
     * Converts an access control list object.
     */
    public static Acl convert(CmisACLType acl) {
        Acl result = convert(acl.getACL(), acl.isExact());

        // handle extensions
        convertExtension(acl, result);

        return result;
View Full Code Here

    }

    private String createDocument(String name, String folderId, String typeId, Map<String, Object> properties, VersioningState verState) {
        ContentStream contentStream = null;
        List<String> policies = null;
        Acl addACEs = null;
        Acl removeACEs = null;
        ExtensionsData extension = null;

        Properties props = createDocumentProperties(name, typeId, properties);

        String id = null;
View Full Code Here

    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

     * org.apache.opencmis.commons.enums.ACLPropagation,
     * org.apache.opencmis.client.provider.ExtensionsData)
     */
    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

    }

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

        Acl acl = bof.createAccessControlList(aces);

        return acl;
    }
View Full Code Here

        originalAceData.put("p1", new String[] { "perm:read", "perm:write", "perm:delete" });
        originalAceData.put("p2", new String[] { "perm:read" });
        originalAceData.put("p3", new String[] { "perm:all" });

        Acl originalACEs = createACL(originalAceData);

        // add
        Map<String, String[]> addAceData = new HashMap<String, String[]>();

        addAceData.put("p2", new String[] { "perm:write" });
        addAceData.put("p4", new String[] { "perm:all" });

        Acl addACEs = createACL(addAceData);

        // remove
        Map<String, String[]> removeAceData = new HashMap<String, String[]>();

        removeAceData.put("p1", new String[] { "perm:write" });
        removeAceData.put("p3", new String[] { "perm:all" });

        Acl removeACEs = createACL(removeAceData);

        Acl newACL = service.publicMergeACLs(originalACEs, addACEs, removeACEs);

        assertEquals(3, newACL.getAces().size());

        for (Ace ace : newACL.getAces()) {
            String principal = ace.getPrincipal().getId();
            assertNotNull(principal);

            if (principal.equals("p1")) {
                assertEquals(2, ace.getPermissions().size());
View Full Code Here

    @Test
    public void testCreateDocumentWithContentNoFileNameNoMimeType() {
        log.info("starting testCreateDocumentWithContent() ...");
        ContentStreamDataImpl contentStream = null;
        List<String> policies = null;
        Acl addACEs = null;
        Acl removeACEs = null;
        ExtensionsData extension = null;

        Properties props = createDocumentProperties(DOCUMENT_ID, DOCUMENT_TYPE_ID);

        contentStream = (ContentStreamDataImpl) createContent();
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.