From d711ae1c1de87ad50fe2b94f3c15fba4f6d3be3f Mon Sep 17 00:00:00 2001 From: Roxana Lucanu-Ghetu Date: Fri, 24 Jun 2016 12:08:41 +0300 Subject: [PATCH] Run the code as system, as some users may not have the rights to add the aspect. --- .../model/rma/aspect/RecordAspect.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java index 16bf1078d1..41cfd0440b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java @@ -159,8 +159,17 @@ public class RecordAspect extends AbstractDisposableItem // Deal with versioned records if (reference.equals(CUSTOM_REF_VERSIONS)) { - // Apply the versioned aspect to the from node - nodeService.addAspect(fromNodeRef, ASPECT_VERSIONED_RECORD, null); + // run as system, to apply the versioned aspect to the from node + // as we can't be sure if the user has add aspect rights + authenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() throws Exception + { + nodeService.addAspect(fromNodeRef, ASPECT_VERSIONED_RECORD, null); + return null; + } + }); } // Execute script if for the reference event