org.apache.chemistry.opencmis.commons.enums.AclPropagation Java Examples
The following examples show how to use
org.apache.chemistry.opencmis.commons.enums.AclPropagation.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AlfrescoCmisServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public Acl applyAcl( String repositoryId, String objectId, final Acl addAces, final Acl removeAces, AclPropagation aclPropagation, ExtensionsData extension) { checkRepositoryId(repositoryId); // We are spec compliant if we just let it through and the tck will not fail CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object"); // relationships don't have ACLs if (info.isVariant(CMISObjectVariant.ASSOC)) { throw new CmisConstraintException("Relationships are not ACL controllable!"); } final NodeRef nodeRef = info.getCurrentNodeNodeRef(); final TypeDefinitionWrapper type = info.getType(); connector.applyACL(nodeRef, type, addAces, removeAces); return connector.getACL(nodeRef, false); }
Example #2
Source File: AlfrescoCmisServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public Acl applyAcl(String repositoryId, String objectId, final Acl aces, AclPropagation aclPropagation) { checkRepositoryId(repositoryId); // We are spec compliant if we just let it through and the tck will not fail CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object"); // relationships don't have ACLs if (info.isVariant(CMISObjectVariant.ASSOC)) { throw new CmisConstraintException("Relationships are not ACL controllable!"); } final NodeRef nodeRef = info.getCurrentNodeNodeRef(); final TypeDefinitionWrapper type = info.getType(); connector.applyACL(nodeRef, type, aces); return connector.getACL(nodeRef, false); }
Example #3
Source File: ConformanceCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Returns the {@code AclPropagation.REPOSITORYDETERMINED} if {@code value} * is {@code null}. */ protected AclPropagation getDefault(AclPropagation value) { if (value == null) { return AclPropagation.REPOSITORYDETERMINED; } return value; }
Example #4
Source File: ConformanceCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public Acl applyAcl(String repositoryId, String objectId, Acl aces, AclPropagation aclPropagation) { checkRepositoryId(repositoryId); checkId("Object Id", objectId); aclPropagation = getDefault(aclPropagation); try { return getWrappedService().applyAcl(repositoryId, objectId, aces, aclPropagation); } catch (Exception e) { throw createCmisException(e); } }
Example #5
Source File: ConformanceCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public Acl applyAcl(String repositoryId, String objectId, Acl addAces, Acl removeAces, AclPropagation aclPropagation, ExtensionsData extension) { checkRepositoryId(repositoryId); checkId("Object Id", objectId); aclPropagation = getDefault(aclPropagation); try { return getWrappedService().applyAcl(repositoryId, objectId, addAces, removeAces, aclPropagation, extension); } catch (Exception e) { throw createCmisException(e); } }
Example #6
Source File: CMISDataCreatorTest.java From SearchServices with GNU Lesser General Public License v3.0 | 5 votes |
public void testCreate() { Session session = getSession("admin", "admin"); String folderName = getRootFolderName(); Folder root = session.getRootFolder(); Map<String, Object> properties = new HashMap<String, Object>(); properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder"); properties.put(PropertyIds.NAME, folderName); // create the folder Folder newFolder = root.createFolder(properties); for(int i = 0; i < 50; i++) { AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl("user"+i); List<String> permissions = new ArrayList<String>(1); permissions.add(BasicPermissions.READ); List<Ace> addAces = new ArrayList<Ace>(1); addAces.add(new AccessControlEntryImpl(principal, permissions)); newFolder.addAcl(addAces, AclPropagation.PROPAGATE); Map<String, Object> updateProperties = new HashMap<String, Object>(); updateProperties.put("cm:title", "Update title "+i); newFolder.updateProperties(properties); if(i % 10 == 0) { System.out.println("@ "+i); } } ItemIterable<QueryResult> result = session.query("select * from cmis:folder", false); assertTrue(result.getTotalNumItems() > 0); result = session.query("select * from cmis:folder where cmis:name = '"+folderName+"'", false); assertTrue(result.getTotalNumItems() > 0); }
Example #7
Source File: CmisTestObject.java From iaf with Apache License 2.0 | 4 votes |
@Override public Acl removeAcl(List<Ace> removeAces, AclPropagation aclPropagation) { // TODO Auto-generated method stub return null; }
Example #8
Source File: CMISConnector.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * Creates the repository info object. */ private RepositoryInfo createRepositoryInfo(CmisVersion cmisVersion) { Descriptor currentDescriptor = descriptorService.getCurrentRepositoryDescriptor(); // get change token boolean auditEnabled = auditService.isAuditEnabled(CMIS_CHANGELOG_AUDIT_APPLICATION, "/" + CMIS_CHANGELOG_AUDIT_APPLICATION); String latestChangeLogToken = null; if (auditEnabled) { EntryIdCallback auditQueryCallback = new EntryIdCallback(false); AuditQueryParameters params = new AuditQueryParameters(); params.setApplicationName(CMIS_CHANGELOG_AUDIT_APPLICATION); params.setForward(false); auditService.auditQuery(auditQueryCallback, params, 1); String entryId = auditQueryCallback.getEntryId(); // MNT-13529 // add initial change log token latestChangeLogToken = entryId == null ? "0" : entryId; } // compile repository info RepositoryInfoImpl ri = new RepositoryInfoImpl(); ri.setId(currentDescriptor.getId()); ri.setName(currentDescriptor.getName()); ri.setDescription(currentDescriptor.getName()); ri.setVendorName("Alfresco"); ri.setProductName("Alfresco " + descriptorService.getServerDescriptor().getEdition()); ri.setProductVersion(currentDescriptor.getVersion()); NodeRef rootNodeRef = getRootNodeRef(); ri.setRootFolder(constructObjectId(rootNodeRef, null)); ri.setCmisVersion(cmisVersion); ri.setChangesIncomplete(true); ri.setChangesOnType(Arrays.asList(new BaseTypeId[] { BaseTypeId.CMIS_DOCUMENT, BaseTypeId.CMIS_FOLDER })); ri.setLatestChangeLogToken(latestChangeLogToken); ri.setPrincipalAnonymous(AuthenticationUtil.getGuestUserName()); ri.setPrincipalAnyone(PermissionService.ALL_AUTHORITIES); RepositoryCapabilitiesImpl repCap = new RepositoryCapabilitiesImpl(); ri.setCapabilities(repCap); repCap.setAllVersionsSearchable(false); repCap.setCapabilityAcl(CapabilityAcl.MANAGE); repCap.setCapabilityChanges(auditEnabled ? CapabilityChanges.OBJECTIDSONLY : CapabilityChanges.NONE); repCap.setCapabilityContentStreamUpdates(CapabilityContentStreamUpdates.ANYTIME); repCap.setCapabilityJoin(CapabilityJoin.NONE); repCap.setCapabilityQuery(CapabilityQuery.BOTHCOMBINED); repCap.setCapabilityRendition(CapabilityRenditions.READ); repCap.setIsPwcSearchable(false); repCap.setIsPwcUpdatable(true); repCap.setSupportsGetDescendants(true); repCap.setSupportsGetFolderTree(true); repCap.setSupportsMultifiling(true); repCap.setSupportsUnfiling(false); repCap.setSupportsVersionSpecificFiling(false); AclCapabilitiesDataImpl aclCap = new AclCapabilitiesDataImpl(); ri.setAclCapabilities(aclCap); aclCap.setAclPropagation(AclPropagation.PROPAGATE); aclCap.setSupportedPermissions(SupportedPermissions.BOTH); aclCap.setPermissionDefinitionData(repositoryPermissions); aclCap.setPermissionMappingData(permissionMappings); return ri; }
Example #9
Source File: CmisTestObject.java From iaf with Apache License 2.0 | 4 votes |
@Override public Acl addAcl(List<Ace> addAces, AclPropagation aclPropagation) { // TODO Auto-generated method stub return null; }
Example #10
Source File: CmisTestObject.java From iaf with Apache License 2.0 | 4 votes |
@Override public Acl applyAcl(List<Ace> addAces, List<Ace> removeAces, AclPropagation aclPropagation) { // TODO Auto-generated method stub return null; }
Example #11
Source File: FilterCmisService.java From iaf with Apache License 2.0 | 4 votes |
@Override public Acl applyAcl(String repositoryId, String objectId, Acl addAces, Acl removeAces, AclPropagation aclPropagation, ExtensionsData extension) { return getAclService().applyAcl(repositoryId, objectId, addAces, removeAces, aclPropagation, extension); }
Example #12
Source File: TestRemovePermissions.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 4 votes |
@Test public void testRemoveAllPermissions_BROWSER_11() { Folder testFolder = null; try { Session session = getBROWSER_11_Session(); if (session == null) { fail("ATOMPUB 1.1 session cannot be null"); } testFolder = createFolder(session, "testRemoveAllPermissions_BROWSER_11"); List<Ace> acl = create2TestACLs(session); // adding new ACE testFolder.addAcl(acl, AclPropagation.PROPAGATE); Acl allacl = session.getAcl(session.createObjectId(testFolder.getId()), false); int oldSize = allacl.getAces().size(); // Removing ALL ACEs Acl newAcl = testFolder.removeAcl(allacl.getAces(), AclPropagation.PROPAGATE); int newsize = newAcl.getAces().size(); System.out.println("Old ace size -->" + oldSize); System.out.println("New ace size --> " + newsize); assertTrue(newsize == oldSize - acl.size()); } catch (Exception ex) { fail(ex.getMessage()); } finally { if (testFolder != null) { testFolder.delete(); } } }
Example #13
Source File: TestRemovePermissions.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 4 votes |
@Test public void testRemoveAllPermissions_ATOMPUB_11() { Folder testFolder = null; try { Session session = getATOMPUB_11_Session(); if (session == null) { fail("ATOMPUB 1.1 session cannot be null"); } testFolder = createFolder(session, "testRemoveAllPermissions_ATOMPUB_11"); List<Ace> acl = create2TestACLs(session); // adding new ACE testFolder.addAcl(acl, AclPropagation.PROPAGATE); Acl allacl = session.getAcl(session.createObjectId(testFolder.getId()), false); int oldSize = allacl.getAces().size(); // Removing ALL ACEs Acl newAcl = testFolder.removeAcl(allacl.getAces(), AclPropagation.PROPAGATE); int newsize = newAcl.getAces().size(); System.out.println("Old ace size -->" + oldSize); System.out.println("New ace size --> " + newsize); assertTrue(newsize == oldSize - acl.size()); } catch (Exception ex) { fail(ex.getMessage()); } finally { if (testFolder != null) { testFolder.delete(); } } }
Example #14
Source File: TestRemovePermissions.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 4 votes |
@Test public void testRemoveAllPermissions_ATOMPUB_10() { Folder testFolder = null; try { Session session = getATOMPUB_10_Session(); if (session == null) { fail("ATOMPUB 1.0 session cannot be null"); } testFolder = createFolder(session, "testRemoveAllPermissions_ATOMPUB_10"); List<Ace> acl = create2TestACLs(session); // adding new ACE testFolder.addAcl(acl, AclPropagation.PROPAGATE); Acl allacl = session.getAcl(session.createObjectId(testFolder.getId()), false); int oldSize = allacl.getAces().size(); // Removing ALL ACEs Acl newAcl = testFolder.removeAcl(allacl.getAces(), AclPropagation.PROPAGATE); int newsize = newAcl.getAces().size(); System.out.println("Old ace size -->" + oldSize); System.out.println("New ace size --> " + newsize); assertTrue(newsize == oldSize - acl.size()); } catch (Exception ex) { fail(ex.getMessage()); } finally { if (testFolder != null) { testFolder.delete(); } } }
Example #15
Source File: TestRemovePermissions.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 4 votes |
/** * cmisws?wsdl is not available using jetty in automated test suite should * be runned using an external alfresco server * */ // @Test public void testRemoveAllPermissions_WEBSERVICE_10() { Folder testFolder = null; try { Session session = getWEBSERVICE_10_Session(); if (session == null) { fail("WEBSERVICE 1.0 session cannot be null"); } testFolder = createFolder(session, "testRemoveAllPermissions_WEBSERVICE_10"); List<Ace> acl = create2TestACLs(session); // adding new ACE testFolder.addAcl(acl, AclPropagation.PROPAGATE); Acl allacl = session.getAcl(session.createObjectId(testFolder.getId()), false); int oldSize = allacl.getAces().size(); // Removing ALL ACEs Acl newAcl = testFolder.removeAcl(allacl.getAces(), AclPropagation.PROPAGATE); int newsize = newAcl.getAces().size(); System.out.println("Old ace size -->" + oldSize); System.out.println("New ace size --> " + newsize); assertTrue(newsize == oldSize - acl.size()); } catch (Exception ex) { fail(ex.getMessage()); } finally { if (testFolder != null) { testFolder.delete(); } } }
Example #16
Source File: CMISDataCreatorTest.java From SearchServices with GNU Lesser General Public License v3.0 | 4 votes |
public void testCreateLots() throws Exception { Session session = getSession("admin", "admin"); Folder root = session.getRootFolder(); String folderNameBase = getRootFolderName(); Map<String, Object> properties = new HashMap<String, Object>(); properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder"); properties.put(PropertyIds.NAME, folderNameBase); Folder base = root.createFolder(properties); for(int i = 0; i < 10; i++) { AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl(""+i+i+i); List<String> permissions = new ArrayList<String>(1); permissions.add(BasicPermissions.ALL); List<Ace> addAces = new ArrayList<Ace>(1); addAces.add(new AccessControlEntryImpl(principal, permissions)); base.addAcl(addAces, AclPropagation.PROPAGATE); } Thread last = null; for(int i = 0; i < 10; i++) { Creator creator = new Creator(base.getPath(), i); Thread thread = new Thread(creator); thread.start(); last = thread; } if(last != null) { last.join(); } ItemIterable<QueryResult> result = session.query("select * from cmis:folder", false); assertTrue(result.getTotalNumItems() > 0); //result = session.query("select * from cmis:folder where cmis:name = '"+folderName+"'", false); //assertTrue(result.getTotalNumItems() > 0); }
Example #17
Source File: AbstractCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Override public Acl applyAcl(String repositoryId, String objectId, Acl aces, AclPropagation aclPropagation) { return service.applyAcl(repositoryId, objectId, aces, aclPropagation); }
Example #18
Source File: AbstractCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Override public Acl applyAcl(String repositoryId, String objectId, Acl addAces, Acl removeAces, AclPropagation aclPropagation, ExtensionsData extension) { return service.applyAcl(repositoryId, objectId, addAces, removeAces, aclPropagation, extension); }
Example #19
Source File: CmisUtils.java From iaf with Apache License 2.0 | 3 votes |
private static AclCapabilities xml2aclCapabilities(Element cmisResult) { AclCapabilitiesDataImpl aclCapabilities = new AclCapabilitiesDataImpl(); Element aclCapabilitiesXml = XmlUtils.getFirstChildTag(cmisResult, "aclCapabilities"); aclCapabilities.setAclPropagation(AclPropagation.valueOf(aclCapabilitiesXml.getAttribute("aclPropagation"))); aclCapabilities.setSupportedPermissions(SupportedPermissions.valueOf(aclCapabilitiesXml.getAttribute("supportedPermissions"))); aclCapabilities.setPermissionMappingData(CmisUtils.xml2permissionMapping(aclCapabilitiesXml)); aclCapabilities.setPermissionDefinitionData(CmisUtils.xml2permissionDefinitionList(aclCapabilitiesXml)); return aclCapabilities; }