protected void deleteACL(DocumentRef ref) throws ClientException { ACP acp = session.getACP(ref); acp.removeACL(aclName); acp.removeACL("inherited"); // make sure to not save the inherited acl // which is dynamically computed session.setACP(ref, acp, true); }
protected static void setLocalAcl(CoreSession session, DocumentModel doc, String value) throws ClientException { ACPImpl acp = new ACPImpl(); ACLImpl acl = new ACLImpl(ACL.LOCAL_ACL); acp.addACL(acl); String[] entries = StringUtils.split(value, ',', true); if (entries.length == 0) { return; } for (String entry : entries) { String[] ace = StringUtils.split(entry, ':', true); acl.add(new ACE(ace[0], ace[1], Boolean.parseBoolean(ace[2]))); } session.setACP(doc.getRef(), acp, false); }
@OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentRef doc) throws Exception { deleteACL(doc); return session.getDocument(doc); }
/** * Saves the document and clear context data to avoid incrementing version in next operations if * not needed. */ public static DocumentModel saveDocument(CoreSession session, DocumentModel doc) throws ClientException { doc = session.saveDocument(doc); return session.getDocument(doc.getRef()); }