protected void createDocumentsWithBender() throws ClientException {
DocumentModel workspacesDocument = session.getDocument(new PathRef(
"/default-domain/workspaces"));
ACP acp = workspacesDocument.getACP();
ACL acl = acp.getOrCreateACL();
acl.add(new ACE("Bender", EVERYTHING, true));
acl.add(new ACE("Leela", READ, true));
workspacesDocument.setACP(acp, true);
session.save();
session.save();
try (CoreSession newSession = openSessionAs("Bender")) {
DocumentModel doc = newSession.createDocumentModel(
workspacesDocument.getPathAsString(), "file1", "File");
doc = newSession.createDocument(doc);
acp = doc.getACP();
acl = acp.getOrCreateACL();
acl.add(new ACE("Leela", READ, true));
doc.setACP(acp, true);
newSession.save();
newSession.save();
doc = newSession.createDocumentModel(
workspacesDocument.getPathAsString(), "file2", "File");
doc = newSession.createDocument(doc);
acp = doc.getACP();
acl = acp.getOrCreateACL();
acl.add(new ACE("Leela", READ, true));
doc.setACP(acp, true);
newSession.save();
newSession.save();
doc = newSession.createDocumentModel(
workspacesDocument.getPathAsString(), "file-without-right",
"File");
doc = newSession.createDocument(doc);
acp = doc.getACP();
acl = acp.getOrCreateACL();
acl.add(new ACE(SecurityConstants.ADMINISTRATOR, READ));
acl.add(ACE.BLOCK);
doc.setACP(acp, true);
newSession.save();
newSession.save();