/** * Removes an ACE given its id. * * @param acp The ACP to modify * @param aclName the name of the ACL to target * @param id the id of the ACE * @return true if something has changed on the document security * @since 7.3 */ public static boolean removePermissionById(ACP acp, String aclName, String id) { return acp.removeACE(aclName, ACE.fromId(id)); } }
protected void replacePermission(DocumentModel doc) { Map<String, Serializable> contextData = new HashMap<>(); contextData.put(NOTIFY_KEY, notify); contextData.put(COMMENT_KEY, comment); ACE oldACE = ACE.fromId(id); ACE newACE = ACE.builder(user, permission) .creator(session.getPrincipal().getName()) .begin(begin) .end(end) .contextData(contextData) .build(); session.replaceACE(doc.getRef(), aclName, oldACE, newACE); }
protected void removePermission(DocumentModel doc) { if (id == null && user == null) { throw new IllegalParameterException("'id' or 'user' parameter must be set"); } ACP acp = doc.getACP() != null ? doc.getACP() : new ACPImpl(); boolean permissionChanged = false; if (user != null) { permissionChanged = acp.removeACEsByUsername(aclName, user); } else if (id != null) { ACE ace = ACE.fromId(id); permissionChanged = acp.removeACE(aclName, ace); } if (permissionChanged) { doc.setACP(acp, true); } }