Run the code as system, as some users may not have the rights to add the aspect.

This commit is contained in:
Roxana Lucanu-Ghetu
2016-06-24 12:08:41 +03:00
parent 019e9d6375
commit d711ae1c1d

View File

@@ -159,8 +159,17 @@ public class RecordAspect extends AbstractDisposableItem
// Deal with versioned records // Deal with versioned records
if (reference.equals(CUSTOM_REF_VERSIONS)) if (reference.equals(CUSTOM_REF_VERSIONS))
{ {
// Apply the versioned aspect to the from node // run as system, to apply the versioned aspect to the from node
nodeService.addAspect(fromNodeRef, ASPECT_VERSIONED_RECORD, null); // as we can't be sure if the user has add aspect rights
authenticationUtil.runAsSystem(new RunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
nodeService.addAspect(fromNodeRef, ASPECT_VERSIONED_RECORD, null);
return null;
}
});
} }
// Execute script if for the reference event // Execute script if for the reference event