Merge branch 'feature-2.4/RM-3300' into 'release/V2.4'

Feature 2.4/rm 3300

On versioning, document can be declared as record if adding record and version aspect is done running as System.
I noticed that the aspect is added only like this in other places where it is used; and the method for creating new recorded version, where the aspect is added, is not used in other places such that changing behavior elsewhere.

See merge request !152
This commit is contained in:
Roxana Lucanu-Ghetu
2016-06-15 10:19:48 +01:00
3 changed files with 143 additions and 2 deletions

View File

@@ -393,7 +393,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
final NodeRef record = recordService.createRecordFromCopy(filePlan, nodeRef);
// apply version record aspect to record
PropertyMap versionRecordProps = new PropertyMap(3);
final PropertyMap versionRecordProps = new PropertyMap(3);
versionRecordProps.put(PROP_VERSIONED_NODEREF, nodeRef);
versionRecordProps.put(RecordableVersionModel.PROP_VERSION_LABEL,
standardVersionProperties.get(
@@ -403,7 +403,16 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
standardVersionProperties.get(
QName.createQName(Version2Model.NAMESPACE_URI,
Version2Model.PROP_VERSION_DESCRIPTION)));
nodeService.addAspect(record, ASPECT_VERSION_RECORD, versionRecordProps);
// run as system 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(record, ASPECT_VERSION_RECORD, versionRecordProps);
return null;
}
});
// wire record up to previous record
linkToPreviousVersionRecord(nodeRef, record);