Skip to content

Commit

Permalink
Audit record for PUTs should not always use "Update" #2471
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
  • Loading branch information
prb112 committed Nov 5, 2021
1 parent 9fae77b commit a7440c9
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 a7440c9

Please sign in to comment.