mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merge branch 'feature-2.4/RM-2967_RMAuditErrorIfUserIsDeleted' into 'release/V2.4'
Feature 2.4/rm 2967 rm audit error if user is deleted RM-2967 - The admin tools audit throws an error when trying to access full information if deleted users created/updated data. - Added exists check in RecordsManagementAuditServiceImpl.java to avoid the illegal argument exception. - Added an empty check in rm-audit.js to remove the "-" if the username is empty because if the user is deleted the text is "Create Person -" - Added a null check in AuditLogGet.java because if you delete the RM site and access the audit page you get a null pointer exception While testing the issue I noticed that the Create Person audit entry appears only after the user is deleted. The audit event is created with immediate auditing on false which makes sense if we only want to audit users related to RM site. If the "Create Person" log appears only after the user was deleted there isn't a reason to try getting the username property at all from a node that we know it doesn't exist. See merge request !95
This commit is contained in:
@@ -1446,7 +1446,11 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
|
|||||||
if (entry.getEvent().equals("Create Person") && entry.getNodeRef() != null)
|
if (entry.getEvent().equals("Create Person") && entry.getNodeRef() != null)
|
||||||
{
|
{
|
||||||
NodeRef nodeRef = entry.getNodeRef();
|
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("nodeName", userName == null ? "": userName);
|
||||||
json.put("createPerson", true);
|
json.put("createPerson", true);
|
||||||
}
|
}
|
||||||
|
@@ -158,6 +158,10 @@ public class AuditLogGet extends BaseAuditRetrievalWebScript
|
|||||||
if( targetNode == null )
|
if( targetNode == null )
|
||||||
{
|
{
|
||||||
targetNode = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
|
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(
|
return AccessStatus.ALLOWED.equals(
|
||||||
capabilityService.getCapabilityAccessState(targetNode, ACCESS_AUDIT_CAPABILITY));
|
capabilityService.getCapabilityAccessState(targetNode, ACCESS_AUDIT_CAPABILITY));
|
||||||
|
Reference in New Issue
Block a user