Skip to content

Commit

Permalink
Merge pull request #2949 from IBM/issue-2471
Browse files Browse the repository at this point in the history
Audit record for PUTs should not always use "Update" #2471
  • Loading branch information
lmsurpre authored Nov 8, 2021
2 parents d0156f4 + a7440c9 commit 3422fc6
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,17 @@ public static void logUpdate(HttpServletRequest request, Resource oldResource, R

AuditLogService auditLogSvc = AuditLogServiceFactory.getService();
if (auditLogSvc.isEnabled()) {
AuditLogEntry entry = initLogEntry(AuditLogEventType.FHIR_UPDATE);
populateAuditLogEntry(entry, request, updatedResource, startTime, endTime, responseStatus);

entry.getContext().setAction("U");
entry.setDescription("FHIR Update request");

auditLogSvc.logEntry(entry);
if (oldResource == null) {
// #2471 - Audit record for PUTs should not always use "Update"
// If the oldResource is null, it doesn't exist and is actually treated as a CREATE.
RestAuditLogger.logCreate(request, updatedResource, startTime, endTime, responseStatus);
} else {
AuditLogEntry entry = initLogEntry(AuditLogEventType.FHIR_UPDATE);
populateAuditLogEntry(entry, request, updatedResource, startTime, endTime, responseStatus);
entry.getContext().setAction("U");
entry.setDescription("FHIR Update request");
auditLogSvc.logEntry(entry);
}
}
log.exiting(CLASSNAME, METHODNAME);
}
Expand Down

0 comments on commit 3422fc6

Please sign in to comment.