login( USERNAME_GEORGE, tenantDuff, new String[] { tenantAuthenticatedRoleName } );
RepositoryFile parentFolder =
repo.getFile( ClientRepositoryPaths.getUserHomeFolderPath( PentahoSessionHolder.getSession().getName() ) );
RepositoryFile newFile = createSampleFile( parentFolder.getPath(), "hello.xaction", "", false, 2, false );
RepositoryFileAcl acls = repo.getAcl( newFile.getId() );
RepositoryFileAcl.Builder newAclBuilder = new RepositoryFileAcl.Builder( acls );
newAclBuilder.entriesInheriting( false ).ace( userNameUtils.getPrincipleId( tenantDuff, USERNAME_PAT ),
RepositoryFileSid.Type.USER, RepositoryFilePermission.ALL );
repo.updateAcl( newAclBuilder.build() );
login( USERNAME_PAT, tenantDuff, new String[] { tenantAuthenticatedRoleName } );
userRoleDao.deleteUser( userGeorge );
// TestPrincipalProvider.enableGeorgeAndDuff(false); simulate delete of george who is owner and explicitly in
// ACE
RepositoryFile fetchedFile = repo.getFileById( newFile.getId() );
assertEquals( USERNAME_GEORGE, repo.getAcl( fetchedFile.getId() ).getOwner().getName() );
assertEquals( RepositoryFileSid.Type.USER, repo.getAcl( fetchedFile.getId() ).getOwner().getType() );
RepositoryFileAcl updatedAcl = repo.getAcl( newFile.getId() );
boolean foundGeorge = false;
for ( RepositoryFileAce ace : updatedAcl.getAces() ) {
if ( USERNAME_GEORGE.equals( ace.getSid().getName() ) ) {
foundGeorge = true;
}
}
}