-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 10.10, 2021.0
-
Fix Version/s: 10.10-HF70, 2023.0, 2021.32
-
Component/s: Security / Rights
-
Release Notes Summary:Collect orphan aceinfo entries after document deletion
-
Release Notes Description:
-
Tags:
-
Backlog priority:750
-
Upgrade notes:
-
Sprint:nxplatform #77, nxplatform #78, nxplatform #85, nxplatform #86
-
Story Points:5
When a document is permanently deleted, the corresponding entries in directory aceinfo are not deleted.
How to reproduce:
- create a document
- create a local permission on the document (see an entry is created in directory aceinfo)
- permanenty delete the document
Expected result: the corresponding entry in directory aceinfo is deleted
Actual result: the corresponding entry in directory aceinfo is NOT deleted
Here is the diff of a unit test showing this behavior:
issions/src/test/java/org/nuxeo/ecm/permissions/TestPermissionListener.java index c751bf20e73..70a826fa18e 100644 --- a/nuxeo-services/nuxeo-permissions/src/test/java/org/nuxeo/ecm/permissions/TestPermissionListener.java +++ b/nuxeo-services/nuxeo-permissions/src/test/java/org/nuxeo/ecm/permissions/TestPermissionListener.java @@ -193,6 +193,39 @@ public class TestPermissionListener { } } + @Test + public void shouldUpdateDirectoryOnDocumentDelete() { + DocumentModel doc = createTestDocument(); + + ACP acp = doc.getACP(); + ACL acl = acp.getOrCreateACL(); + ACE fryACE = new ACE("fry", WRITE, true); + fryACE.putContextData(NOTIFY_KEY, true); + fryACE.putContextData(COMMENT_KEY, "fry comment"); + ACE leelaACE = new ACE("leela", READ, true); + acl.add(fryACE); + acl.add(leelaACE); + acp.addACL(acl); + doc.setACP(acp, true); + + try (Session session = directoryService.open(ACE_INFO_DIRECTORY)) { + Map<String, Serializable> filter = new HashMap<>(); + filter.put("docId", doc.getId()); + DocumentModelList entries = session.query(filter); + assertEquals(2, entries.size()); + + } + String docId = doc.getId(); + session.removeDocument(doc.getRef()); + try (Session session = directoryService.open(ACE_INFO_DIRECTORY)) { + Map<String, Serializable> filter = new HashMap<>(); + filter.put("docId", docId); + DocumentModelList entries = session.query(filter); + assertEquals(0, entries.size()); + + } + } + @Test public void shouldStoreNotifyAndComment() { DocumentModel doc = createTestDocument();