Merge branch 'feature/RM-6223_AuditCreateUserEvent' into 'master'

Fix for RM-6223 Create User Event  not displayed in Audit Logs

See merge request records-management/records-management!963
This commit is contained in:
Rodica Sutu
2018-04-24 08:40:49 +01:00
2 changed files with 57 additions and 3 deletions

View File

@@ -981,9 +981,10 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
return true;
}
if(nodeRef != null && nodeService.exists(nodeRef) &&
!AccessStatus.ALLOWED.equals(
capabilityService.getCapabilityAccessState(nodeRef, ACCESS_AUDIT_CAPABILITY)))
if (nodeRef != null && nodeService.exists(nodeRef) &&
filePlanService.isFilePlanComponent(nodeRef) &&
!AccessStatus.ALLOWED.equals(
capabilityService.getCapabilityAccessState(nodeRef, ACCESS_AUDIT_CAPABILITY)))
{
return true;
}

View File

@@ -518,6 +518,59 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
});
}
/**
* Given I have created a user
* When I will get the RM audit filter by create user event
* Then there will be an entry for the created user
*
* @throws Exception
*/
@org.junit.Test
public void testAuditForCreateUser() throws Exception
{
doBehaviourDrivenTest(new BehaviourDrivenTest()
{
final static String CREATE_USER_AUDIT_EVENT = "Create Person";
String userName = "auditCreateUser";
NodeRef user;
List<RecordsManagementAuditEntry> entry;
@Override
public void given() throws Exception
{
// create a user
user = createPerson(userName);
}
@Override
public void when() throws Exception
{
// set the audit query param
RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters();
params.setEvent(CREATE_USER_AUDIT_EVENT);
// get the audit events for "Create Person"
entry = getAuditTrail(params, 1, ADMIN_USER);
}
@Override
public void then() throws Exception
{
assertEquals("Create user event is not audited.",
CREATE_USER_AUDIT_EVENT, entry.get(0).getEvent());
}
@Override
public void after()
{
// Stop and delete all entries
rmAuditService.stopAuditLog(filePlan);
rmAuditService.clearAuditLog(filePlan);
}
});
}
/** === Helper methods === */
private List<RecordsManagementAuditEntry> getAuditTrail(String asUser)