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


        // 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

        assertEquals(object.getAllowableActions(), allowableActions);

        // check ACLS
        if (supportsDiscoverACLs()) {
            Acl acl = getBinding().getAclService().getAcl(getTestRepositoryId(), objectId, Boolean.FALSE, null);

            assertEquals(object.getAcl(), acl);
        } else {
            warning("ACLs not supported!");
        }
View Full Code Here

        // get parameters
        String objectId = getStringParameter(request, Constants.PARAM_ID);
        Boolean onlyBasicPermissions = getBooleanParameter(request, Constants.PARAM_ONLY_BASIC_PERMISSIONS);

        // execute
        Acl acl = service.getAcl(repositoryId, objectId, onlyBasicPermissions, null);

        if (acl == null) {
            throw new CmisRuntimeException("ACL is null!");
        }
View Full Code Here

        if (!(((JAXBElement<?>) aclRequest).getValue() instanceof CmisAccessControlListType)) {
            throw new CmisInvalidArgumentException("Not an ACL document!");
        }

        Acl aces = convert((CmisAccessControlListType) ((JAXBElement<?>) aclRequest).getValue(), null);

        // execute
        Acl acl = service.applyAcl(repositoryId, objectId, aces, aclPropagation);

        // set headers
        response.setStatus(HttpServletResponse.SC_CREATED);
        response.setContentType(Constants.MEDIATYPE_ACL);
View Full Code Here

        // get parameters
        String objectId = getStringParameter(request, Constants.PARAM_ID);
        Boolean onlyBasicPermissions = getBooleanParameter(request, Constants.PARAM_ONLY_BASIC_PERMISSIONS);

        // execute
        Acl acl = service.getAcl(repositoryId, objectId, onlyBasicPermissions, null);

        if (acl == null) {
            throw new CmisRuntimeException("ACL is null!");
        }
View Full Code Here

        if (!(((JAXBElement<?>) aclRequest).getValue() instanceof CmisAccessControlListType)) {
            throw new CmisInvalidArgumentException("Not an ACL document!");
        }

        Acl aces = convert((CmisAccessControlListType) ((JAXBElement<?>) aclRequest).getValue(), null);

        // execute
        Acl acl = service.applyAcl(repositoryId, objectId, aces, aclPropagation);

        // set headers
        response.setStatus(HttpServletResponse.SC_CREATED);
        response.setContentType(Constants.MEDIATYPE_ACL);
View Full Code Here

     */
    public static Acl convert(CmisACLType acl) {
        if (acl == null)
            return null;
       
        Acl result = convert(acl.getACL(), acl.isExact());

        // handle extensions
        convertExtension(acl, result);

        return result;
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

        assertEquals(object.getAllowableActions(), allowableActions);

        // check ACLS
        if (supportsDiscoverACLs()) {
            Acl acl = getBinding().getAclService().getAcl(getTestRepositoryId(), objectId, Boolean.FALSE, null);

            assertEquals(object.getAcl(), acl);
        } else {
            warning("ACLs not supported!");
        }
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.