protected void resetPermissions(DocumentModel doc, String userName) { ACP acp = session.getACP(doc.getRef()); ACL localACL = acp.getOrCreateACL(ACL.LOCAL_ACL); Iterator<ACE> localACLIt = localACL.iterator(); while (localACLIt.hasNext()) { ACE ace = localACLIt.next(); if (userName.equals(ace.getUsername())) { localACLIt.remove(); } } session.setACP(doc.getRef(), acp, true); session.save(); }
protected void resetPermissions(DocumentRef docRef, String userName) { ACP acp = session.getACP(docRef); ACL localACL = acp.getOrCreateACL(ACL.LOCAL_ACL); Iterator<ACE> localACLIt = localACL.iterator(); while (localACLIt.hasNext()) { ACE ace = localACLIt.next(); if (userName.equals(ace.getUsername())) { localACLIt.remove(); } } session.setACP(docRef, acp, true); TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); }