/** * 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 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); } }