DOD Recert: RM Audit

* improved display so it's easier to see what's going on
  * audit user creation 



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/DEV/DODRECERT@51082 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2013-06-14 05:31:06 +00:00
parent 6221898e61
commit 7fad3a8b3d

View File

@@ -326,6 +326,10 @@ public class RecordsManagementAuditServiceImpl
new AuditEvent("createDispositionSchedule", MSG_CREATE_DISPOSITION_SCHEDULE));
this.auditEvents.put("unfreeze",
new AuditEvent("unfreeze", MSG_UNFREEZE));
// Added for DOD compliance
this.auditEvents.put("createPerson",
new AuditEvent("createPerson", "User Created"));
}
@Override
@@ -345,7 +349,11 @@ public class RecordsManagementAuditServiceImpl
policyComponent.bindClassBehaviour(
BeforeDeleteNodePolicy.QNAME,
RecordsManagementModel.ASPECT_RECORD_COMPONENT_ID,
new JavaBehaviour(this, "beforeDeleteNode"));
new JavaBehaviour(this, "beforeDeleteNode"));
policyComponent.bindClassBehaviour(
OnCreateNodePolicy.QNAME,
ContentModel.TYPE_PERSON,
new JavaBehaviour(this, "onCreatePersonNode"));
}
@Override
@@ -477,7 +485,12 @@ public class RecordsManagementAuditServiceImpl
{
auditRMEvent(childAssocRef.getChildRef(), RM_AUDIT_EVENT_CREATE_RM_OBJECT, null, null);
}
public void onCreatePersonNode(ChildAssociationRef childAssocRef)
{
auditRMEvent(childAssocRef.getChildRef(), "createPerson", null, null);
}
/**
* {@inheritDoc}
* @since 3.2
@@ -509,19 +522,9 @@ public class RecordsManagementAuditServiceImpl
{
// Deleted nodes will not be available at the end of the transaction. The data needs to
// be extracted now and the audit entry needs to be created now.
Map<String, Serializable> auditMap = new HashMap<String, Serializable>(13);
auditMap.put(
AuditApplication.buildPath(
RecordsManagementAuditService.RM_AUDIT_SNIPPET_EVENT,
RecordsManagementAuditService.RM_AUDIT_SNIPPET_NAME),
eventName);
// Action node
auditMap.put(
AuditApplication.buildPath(
RecordsManagementAuditService.RM_AUDIT_SNIPPET_EVENT,
RecordsManagementAuditService.RM_AUDIT_SNIPPET_NODE),
nodeRef);
Map<String, Serializable> auditMap = buildAuditMap(nodeRef, eventName);
auditMap = auditComponent.recordAuditValues(RecordsManagementAuditService.RM_AUDIT_PATH_ROOT, auditMap);
if (logger.isDebugEnabled())
{
logger.debug("RM Audit: Audited node deletion: \n" + auditMap);
@@ -559,6 +562,31 @@ public class RecordsManagementAuditServiceImpl
// That is it. The values are queued for the end of the transaction.
}
}
/**
* Helper method to build audit map
*
* @param nodeRef
* @param eventName
* @return
* @since 2.0.3
*/
private Map<String, Serializable> buildAuditMap(NodeRef nodeRef, String eventName)
{
Map<String, Serializable> auditMap = new HashMap<String, Serializable>(13);
auditMap.put(
AuditApplication.buildPath(
RecordsManagementAuditService.RM_AUDIT_SNIPPET_EVENT,
RecordsManagementAuditService.RM_AUDIT_SNIPPET_NAME),
eventName);
// Action node
auditMap.put(
AuditApplication.buildPath(
RecordsManagementAuditService.RM_AUDIT_SNIPPET_EVENT,
RecordsManagementAuditService.RM_AUDIT_SNIPPET_NODE),
nodeRef);
return auditMap;
}
/**
* A <b>stateless</b> transaction listener for RM auditing. This component picks up the data of
@@ -619,20 +647,13 @@ public class RecordsManagementAuditServiceImpl
RMAuditNode auditedNode = entry.getValue();
Map<String, Serializable> auditMap = new HashMap<String, Serializable>(13);
// Action description
String eventName = auditedNode.getEventName();
auditMap.put(
AuditApplication.buildPath(
RecordsManagementAuditService.RM_AUDIT_SNIPPET_EVENT,
RecordsManagementAuditService.RM_AUDIT_SNIPPET_NAME),
eventName);
// Action node
auditMap.put(
AuditApplication.buildPath(
RecordsManagementAuditService.RM_AUDIT_SNIPPET_EVENT,
RecordsManagementAuditService.RM_AUDIT_SNIPPET_NODE),
nodeRef);
Map<String, Serializable> auditMap = buildAuditMap(nodeRef, eventName);
// TODO do we care if the before and after are null??
// Property changes
Map<QName, Serializable> propertiesBefore = auditedNode.getNodePropertiesBefore();
Map<QName, Serializable> propertiesAfter = auditedNode.getNodePropertiesAfter();
@@ -652,6 +673,7 @@ public class RecordsManagementAuditServiceImpl
RecordsManagementAuditService.RM_AUDIT_SNIPPET_CHANGES,
RecordsManagementAuditService.RM_AUDIT_SNIPPET_AFTER),
(Serializable) deltaPair.getSecond());
// Audit it
if (logger.isDebugEnabled())
{
@@ -1224,7 +1246,18 @@ public class RecordsManagementAuditServiceImpl
json.put("userRole", entry.getUserRole() == null ? "": entry.getUserRole());
json.put("fullName", entry.getFullName() == null ? "": entry.getFullName());
json.put("nodeRef", entry.getNodeRef() == null ? "": entry.getNodeRef());
json.put("nodeName", entry.getNodeName() == null ? "": entry.getNodeName());
if (entry.getEvent().equals("createPerson") == true && entry.getNodeRef() != null)
{
NodeRef nodeRef = entry.getNodeRef();
String userName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_USERNAME);
json.put("nodeName", userName == null ? "": userName);
}
else
{
json.put("nodeName", entry.getNodeName() == null ? "": entry.getNodeName());
}
json.put("nodeType", entry.getNodeType() == null ? "": entry.getNodeType());
json.put("event", entry.getEvent() == null ? "": getAuditEventLabel(entry.getEvent()));
json.put("identifier", entry.getIdentifier() == null ? "": entry.getIdentifier());