{
RepositoryFile newFolder =
repo.createFolder( parentFolder.getId(), new RepositoryFile.Builder( "testFolder" ).folder( true ).build(),
null, null );
RepositoryFileAcl acl = repo.getAcl( newFolder.getId() );
RepositoryFileAcl newAcl =
new RepositoryFileAcl.Builder( acl ).ace( userNameUtils.getPrincipleId( tenantAcme, USERNAME_ADMIN ),
RepositoryFileSid.Type.USER, RepositoryFilePermission.ALL ).entriesInheriting( true ).build();
repo.updateAcl( newAcl );
login( USERNAME_ADMIN, tenantAcme, new String[] { tenantAdminRoleName, tenantAuthenticatedRoleName } );
try {
repo.deleteFile( newFolder.getId(), null );
} catch ( Exception e ) {
e.printStackTrace();
fail();
}
}
// Now try one not inheriting
//CHECKSTYLE IGNORE AvoidNestedBlocks FOR NEXT 3 LINES
{
RepositoryFile newFolder =
repo.createFolder( parentFolder.getId(), new RepositoryFile.Builder( "testFolder2" ).folder( true ).build(),
null, null );
RepositoryFileAcl acl = repo.getAcl( newFolder.getId() );
RepositoryFileAcl newAcl =
new RepositoryFileAcl.Builder( acl ).clearAces().ace(
userNameUtils.getPrincipleId( tenantAcme, USERNAME_ADMIN ), RepositoryFileSid.Type.USER,
RepositoryFilePermission.ALL ).entriesInheriting( false ).build();
repo.updateAcl( newAcl );