use of com.enonic.xp.content.ImportContentParams in project xp by enonic.
the class ContentServiceImplTest_importContent method skipSourcePermissionsOnCreate.
@Test
public void skipSourcePermissionsOnCreate() throws Exception {
final AccessControlList aclList = AccessControlList.create().add(AccessControlEntry.create().principal(TEST_DEFAULT_USER.getKey()).allowAll().deny(Permission.DELETE).build()).build();
final Content sourceContent = ctxDefault().callWith(() -> createContent(ContentPath.ROOT, "content1", aclList));
final ImportContentParams importContentParams = ImportContentParams.create().importContent(sourceContent).targetPath(ContentPath.from(ContentPath.ROOT, sourceContent.getName().toString())).importPermissionsOnCreate(false).build();
final Content importedContent = ctxOther().callWith(() -> this.contentService.importContent(importContentParams).getContent());
assertNotEquals(sourceContent.getPermissions(), importedContent.getPermissions());
}
use of com.enonic.xp.content.ImportContentParams in project xp by enonic.
the class ContentServiceImplTest_importContent method keepSourcePermissionsOnCreate.
@Test
public void keepSourcePermissionsOnCreate() throws Exception {
final AccessControlList aclList = AccessControlList.create().add(AccessControlEntry.create().principal(TEST_DEFAULT_USER.getKey()).allowAll().deny(Permission.DELETE).build()).build();
final Content sourceContent = ctxDefault().callWith(() -> createContent(ContentPath.ROOT, "content1", aclList));
final ImportContentParams importContentParams = ImportContentParams.create().importContent(sourceContent).targetPath(ContentPath.from(ContentPath.ROOT, sourceContent.getName().toString())).importPermissionsOnCreate(true).build();
final Content importedContent = ctxOther().callWith(() -> this.contentService.importContent(importContentParams).getContent());
assertEquals(sourceContent.getPermissions(), importedContent.getPermissions());
}
Aggregations