Merge release/V2.4 into master

This commit is contained in:
Ana Bozianu
2016-04-04 09:55:10 +03:00
3 changed files with 35 additions and 24 deletions

View File

@@ -1446,7 +1446,11 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
if (entry.getEvent().equals("Create Person") && entry.getNodeRef() != null)
{
NodeRef nodeRef = entry.getNodeRef();
String userName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_USERNAME);
String userName = null;
if(nodeService.exists(nodeRef))
{
userName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_USERNAME);
}
json.put("nodeName", userName == null ? "": userName);
json.put("createPerson", true);
}

View File

@@ -269,7 +269,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
* @param form
* @param nodeRef
*/
protected void addTransientProperties(Form form, final NodeRef nodeRef)
protected void addTransientProperties(final Form form, final NodeRef nodeRef)
{
if (recordService.isRecord(nodeRef))
{
@@ -277,33 +277,36 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
}
// Need to get the disposition schedule as the system user. See RM-1727.
DispositionSchedule ds = runAsSystem(new RunAsWork<DispositionSchedule>()
//Need to run all block as the system user, needed for disposition instructions, recordCategory and categoryId. See RM-3077.
runAsSystem(new RunAsWork<Void>()
{
@Override
public DispositionSchedule doWork()
public Void doWork() throws Exception
{
return getDispositionService().getDispositionSchedule(nodeRef);
DispositionSchedule ds = getDispositionService().getDispositionSchedule(nodeRef);
if (ds != null)
{
String instructions = ds.getDispositionInstructions();
if (instructions != null)
{
addTransientPropertyField(form, TRANSIENT_DISPOSITION_INSTRUCTIONS, DataTypeDefinition.TEXT,
instructions);
}
NodeRef recordCategory = getDispositionService().getAssociatedRecordsManagementContainer(ds);
if (recordCategory != null)
{
String categoryId = (String) nodeService.getProperty(recordCategory, PROP_IDENTIFIER);
if (categoryId != null)
{
addTransientPropertyField(form, TRANSIENT_CATEGORY_ID, DataTypeDefinition.TEXT, categoryId);
}
}
}
return null;
}
});
if (ds != null)
{
String instructions = ds.getDispositionInstructions();
if (instructions != null)
{
addTransientPropertyField(form, TRANSIENT_DISPOSITION_INSTRUCTIONS, DataTypeDefinition.TEXT, instructions);
}
NodeRef recordCategory = getDispositionService().getAssociatedRecordsManagementContainer(ds);
if (recordCategory != null)
{
String categoryId = (String)nodeService.getProperty(recordCategory, PROP_IDENTIFIER);
if (categoryId != null)
{
addTransientPropertyField(form, TRANSIENT_CATEGORY_ID, DataTypeDefinition.TEXT, categoryId);
}
}
}
}
/**

View File

@@ -158,6 +158,10 @@ public class AuditLogGet extends BaseAuditRetrievalWebScript
if( targetNode == null )
{
targetNode = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
if(targetNode == null)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "The default RM site was not found");
}
}
return AccessStatus.ALLOWED.equals(
capabilityService.getCapabilityAccessState(targetNode, ACCESS_AUDIT_CAPABILITY));