From 0c2143918f49fb87b96eaac10a3814c3fef09076 Mon Sep 17 00:00:00 2001 From: Jared Ottley Date: Thu, 5 Sep 2013 22:04:54 +0000 Subject: [PATCH] [RM-878] Deleting folder with declared records does not remove groups from the extended groups properties. Add new behaviour to look for child associations where the node is not primary, has the rma:recordOriginatingDetails aspect and where the deleted parent is a folder. If all matches, then remove the extended security properties from the "primary" child node. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@55000 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../record/RecordServiceImpl.java | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java index 72d9d492a7..b2d719e2f5 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java @@ -198,6 +198,10 @@ public class RecordServiceImpl implements RecordService, this, "onUpdateProperties", NotificationFrequency.EVERY_EVENT); + private JavaBehaviour onDeleteDeclaredRecordLink = new JavaBehaviour( + this, + "onDeleteDeclaredRecordLink", + NotificationFrequency.FIRST_EVENT); @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException @@ -339,6 +343,11 @@ public class RecordServiceImpl implements RecordService, NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME, ASPECT_RECORD, onUpdateProperties); + policyComponent.bindAssociationBehaviour( + NodeServicePolicies.BeforeDeleteChildAssociationPolicy.QNAME, + ContentModel.TYPE_FOLDER, + ContentModel.ASSOC_CONTAINS, + onDeleteDeclaredRecordLink); } /** @@ -428,7 +437,28 @@ public class RecordServiceImpl implements RecordService, { onUpdateProperties.enable(); } - } + } + + /** + * Looking specifically at linked content that was declared a record from a non-rm site. + * When the site or the folder that the link was declared in is deleted we need to remove + * the extended security property accounts in the tree + * + * @param childAssocRef + */ + public void onDeleteDeclaredRecordLink(ChildAssociationRef childAssocRef) + { + // Is the deleted child association not a primary association? + // Does the deleted child association have the rma:recordOriginatingDetails aspect? + // Is the parent of the deleted child association a folder (cm:folder)? + if (!childAssocRef.isPrimary() && + nodeService.hasAspect(childAssocRef.getChildRef(), ASPECT_RECORD_ORIGINATING_DETAILS) && + nodeService.getType(childAssocRef.getParentRef()).equals(ContentModel.TYPE_FOLDER)) + { + // ..then remove the extended readers and writers up the tree for this remaining node + extendedSecurityService.removeExtendedSecurity(childAssocRef.getChildRef(), extendedSecurityService.getExtendedReaders(childAssocRef.getChildRef()), extendedSecurityService.getExtendedWriters(childAssocRef.getChildRef()), true); + } + } /** * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#disablePropertyEditableCheck()