public void testPermissionPropagation() { if (!enumCapabilityACL.manage.Equals(getCapabilityACL())) { Assert.Skip("Repository doesn't support 'manage ACL' capability."); } if (aclPrincipalId == null || aclUsername == null || aclPassword == null) { Assert.Skip("ACL Credentials or ACL PrincipalId were not set."); } if (!enumACLPropagation.propagate.Equals(getACLPropagation())) { Assert.Skip("ACL Propagation is not supported."); } string folderId = createAndAssertFolder(getAndAssertRootFolder()).ObjectId; string documentId = createAndAssertObject(folderId, null).ObjectId; cmisAccessControlListType acList = createSimpleACL(aclPrincipalId, PERMISSION_READ); logger.log("[ACLService->applyACL]"); aclServiceClient.applyACL(getAndAssertRepositoryId(), folderId, acList, null, getACLPropagation(), null); getPropertiesUsingCredentials(documentId, aclUsername, aclPassword); deleteAndAssertObject(documentId); deleteAndAssertObject(folderId); }
public void testWritePermission() { if (!enumCapabilityACL.manage.Equals(getCapabilityACL())) { Assert.Skip("Repository doesn't support 'manage ACL' capability."); } if (aclPrincipalId == null || aclUsername == null || aclPassword == null) { Assert.Skip("ACL Credentials or ACL PrincipalId were not set."); } cmisAccessControlListType acList = createSimpleACL(aclPrincipalId, PERMISSION_WRITE); logger.log("[ACLService->applyACL]"); aclServiceClient.applyACL(getAndAssertRepositoryId(), documentId, acList, null, getACLPropagation(), null); updatePropertiesUsingCredentials(documentId, aclUsername, aclPassword); }
public void testAddAndRemovePermissionConstraints() { if (!enumCapabilityACL.manage.Equals(getCapabilityACL())) { Assert.Skip("Repository doesn't support 'manage ACL' capability."); } if (aclPrincipalId == null || aclUsername == null || aclPassword == null) { Assert.Skip("ACL Credentials or ACL PrincipalId were not set."); } cmisAccessControlListType acList = createSimpleACL("Invalid principal", "Invalid permission"); try { logger.log("[ACLService->applyACL]"); aclServiceClient.applyACL(INVALID_REPOSITORY_ID, documentId, acList, null, getACLPropagation(), null); Assert.Skip("Exception expected"); } catch (FaultException <cmisFaultType> e) { } try { logger.log("[ACLService->applyACL]"); aclServiceClient.applyACL(getAndAssertRepositoryId(), INVALID_OBJECT_ID, acList, null, getACLPropagation(), null); Assert.Skip("Exception expected"); } catch (FaultException <cmisFaultType> e) { } try { logger.log("[ACLService->applyACL]"); aclServiceClient.applyACL(getAndAssertRepositoryId(), documentId, acList, null, getACLPropagation(), null); Assert.Skip("Exception expected"); } catch (FaultException <cmisFaultType> e) { } }
public void testGetContentChangesForSecurity() { if (getCapabilityChanges().Equals(enumCapabilityChanges.none)) { throw new SkippedException("Content Changes Capability is not supported"); } //TODO: Change document creation to default versioning state after versioning problem will be fixed string objectId = createAndAssertObject(getAndAssertRootFolder(), enumVersioningState.none).ObjectId; string changeLogToken = getAndAssertRepositoryInfo().latestChangeLogToken; cmisAccessControlListType acList = createSimpleACL(aclPrincipalId, PERMISSION_WRITE); logger.log("[ACLService->applyACL]"); aclServiceClient.applyACL(getAndAssertRepositoryId(), objectId, acList, null, getACLPropagation(), null); cmisObjectListType response = receiveAndAssertContentChanges(ref changeLogToken, null); assertContentChanges(response, objectId, enumTypeOfChanges.security); }
public void testGetACEs() { if (!enumCapabilityACL.manage.Equals(getCapabilityACL())) { Assert.Skip("Repository doesn't support 'manage ACL' capability."); } if (aclPrincipalId == null || aclUsername == null || aclPassword == null) { Assert.Skip("ACL Credentials or ACL PrincipalId were not set."); } cmisAccessControlListType acList = createSimpleACL(aclPrincipalId, PERMISSION_READ); logger.log("[ACLService->applyACL]"); aclServiceClient.applyACL(getAndAssertRepositoryId(), documentId, acList, null, getACLPropagation(), null); logger.log("[ACLService->getACL]"); cmisACLType aclType = aclServiceClient.getACL(getAndAssertRepositoryId(), documentId, true, null); Assert.IsTrue(aclType != null && aclType.acl != null && aclType.acl.permission != null, "No ACE were returned"); bool contains = false; foreach (cmisAccessControlEntryType receivedAce in aclType.acl.permission) { Assert.IsTrue(receivedAce != null && receivedAce.permission != null && receivedAce.principal != null, "Incorrect ACE was returned"); if (receivedAce.principal.principalId != null && receivedAce.principal.principalId.Equals(aclPrincipalId)) { foreach (String permission in receivedAce.permission) { Assert.IsNotNull(permission, "Incorrect permission was returned"); if (permission.Equals(PERMISSION_READ)) { contains = true; } } } } Assert.IsTrue(contains, "Response doesn't contain expected permission"); }
public FileableObject(enumTypesOfFileableObjects objectType, string objectParentId, string objectTypeId, cmisPropertiesType properties, cmisAccessControlListType addACEs, cmisAccessControlListType removeACEs) : base(objectType, objectParentId, objectTypeId, properties) { this.addACEs = addACEs; this.removeACEs = removeACEs; }
protected cmisAccessControlListType createSimpleACL(string principalId, string permission) { cmisAccessControlListType acList = new cmisAccessControlListType(); cmisAccessControlPrincipalType principal = new cmisAccessControlPrincipalType(); principal.principalId = principalId; cmisAccessControlEntryType ace = new cmisAccessControlEntryType(); ace.principal = principal; ace.permission = new string[] { permission }; ace.direct = true; acList.permission = new cmisAccessControlEntryType[] { ace }; return acList; }
protected static FileableObject createAndAssertObject(bool folder, string parentFolderId, string objectTypeId, cmisAccessControlListType addACEs, cmisAccessControlListType removeACEs) { enumTypesOfFileableObjects objectType = (folder) ? (enumTypesOfFileableObjects.folders) : (enumTypesOfFileableObjects.documents); return createAndAssertObject(new FileableObject(objectType, parentFolderId, objectTypeId, null, addACEs, removeACEs)); }