RepositoryFile parentFolder =
repo.getFile( ClientRepositoryPaths.getUserHomeFolderPath( PentahoSessionHolder.getSession().getName() ) );
RepositoryFile newFolder = new RepositoryFile.Builder( "test" ).folder( true ).versioned( true ).build();
newFolder = repo.createFolder( parentFolder.getId(), newFolder, null );
RepositoryFileAcl acl = repo.getAcl( newFolder.getId() );
assertEquals( true, acl.isEntriesInheriting() );
assertEquals( new RepositoryFileSid( USERNAME_SUZY ), acl.getOwner() );
assertEquals( newFolder.getId(), acl.getId() );
assertTrue( acl.getAces().isEmpty() );
RepositoryFileAcl newAcl =
new RepositoryFileAcl.Builder( acl ).ace( userNameUtils.getPrincipleId( tenantAcme, USERNAME_TIFFANY ),
RepositoryFileSid.Type.USER, RepositoryFilePermission.READ ).entriesInheriting( true ).build();
RepositoryFileAcl fetchedAcl = repo.updateAcl( newAcl );
// since isEntriesInheriting is true, ace addition should not have taken
assertTrue( fetchedAcl.getAces().isEmpty() );
newAcl =
new RepositoryFileAcl.Builder( acl ).ace( userNameUtils.getPrincipleId( tenantAcme, USERNAME_TIFFANY ),
RepositoryFileSid.Type.USER, RepositoryFilePermission.READ ).build(); // calling ace sets
// entriesInheriting to false
fetchedAcl = repo.updateAcl( newAcl );
// since isEntriesInheriting is false, ace addition should have taken
assertFalse( fetchedAcl.getAces().isEmpty() );
}