userRoleDao.createUser( tenantAcme, USERNAME_SUZY, PASSWORD, "", null );
userRoleDao.createUser( tenantAcme, USERNAME_TIFFANY, PASSWORD, "", null );
defaultBackingRepositoryLifecycleManager.newTenant();
login( USERNAME_SUZY, tenantAcme, new String[] { tenantAuthenticatedRoleName } );
RepositoryFile acmePublicFolder =
repo.getFile( ClientRepositoryPaths.getUserHomeFolderPath( PentahoSessionHolder.getSession().getName() ) );
List<RepositoryFileAce> expectedEffectiveAces1 = repo.getEffectiveAces( acmePublicFolder.getId() );
RepositoryFile newFolder = new RepositoryFile.Builder( "test" ).folder( true ).versioned( true ).build();
newFolder = repo.createFolder( acmePublicFolder.getId(), newFolder, null );
assertEquals( expectedEffectiveAces1, repo.getEffectiveAces( newFolder.getId() ) );
RepositoryFileAcl acl = repo.getAcl( newFolder.getId() );
RepositoryFileAcl newAcl =
new RepositoryFileAcl.Builder( acl ).entriesInheriting( false ).ace(
new RepositoryFileSid( userNameUtils.getPrincipleId( tenantAcme, USERNAME_SUZY ) ),
RepositoryFilePermission.ALL ).ace(
new RepositoryFileSid( userNameUtils.getPrincipleId( tenantAcme, USERNAME_TIFFANY ) ),
RepositoryFilePermission.READ ).build();
repo.updateAcl( newAcl );
List<RepositoryFileAce> expectedEffectiveAces2 = new ArrayList<RepositoryFileAce>();
expectedEffectiveAces2.add( new RepositoryFileAce( new RepositoryFileSid( USERNAME_SUZY ), EnumSet
.of( RepositoryFilePermission.ALL ) ) );
expectedEffectiveAces2.add( new RepositoryFileAce( new RepositoryFileSid( USERNAME_TIFFANY ), EnumSet
.of( RepositoryFilePermission.READ ) ) );
assertEquals( expectedEffectiveAces2, repo.getEffectiveAces( newFolder.getId() ) );
assertEquals( expectedEffectiveAces2, repo.getEffectiveAces( newFolder.getId(), false ) );
assertEquals( expectedEffectiveAces1, repo.getEffectiveAces( newFolder.getId(), true ) );
}