diff --git a/legal-core/src/main/java/org/opengroup/osdu/legal/api/LegalTagApi.java b/legal-core/src/main/java/org/opengroup/osdu/legal/api/LegalTagApi.java index f78078a8db8184d95b28dc947367ac1cd46608fb..293aa55ee9fe0f20b0570e145be9a8708bc1a1e6 100644 --- a/legal-core/src/main/java/org/opengroup/osdu/legal/api/LegalTagApi.java +++ b/legal-core/src/main/java/org/opengroup/osdu/legal/api/LegalTagApi.java @@ -1,6 +1,7 @@ package org.opengroup.osdu.legal.api; import com.google.gson.Gson; +import java.util.Collections; import org.opengroup.osdu.legal.countries.LegalTagCountriesService; import org.opengroup.osdu.legal.logging.AuditLogger; import org.opengroup.osdu.legal.tags.LegalTagService; @@ -137,7 +138,7 @@ public class LegalTagApi { output.setPersonalDataTypes(allowedLegaltagPropertyValues.getPersonalDataType()); output.setSecurityClassifications(allowedLegaltagPropertyValues.getSecurityClassifications()); output.setDataTypes(allowedLegaltagPropertyValues.getDataTypes()); - auditLogger.readLegalPropertiesSuccess(); + auditLogger.readLegalPropertiesSuccess(Collections.singletonList(output.toString())); return new ResponseEntity<ReadablePropertyValues>(output, HttpStatus.OK); } diff --git a/legal-core/src/main/java/org/opengroup/osdu/legal/logging/AuditEvents.java b/legal-core/src/main/java/org/opengroup/osdu/legal/logging/AuditEvents.java index fc00f8beedb34fed1351e3919696272c8033b09a..7331668c656e11ee91ea323933a5172e129c42f4 100644 --- a/legal-core/src/main/java/org/opengroup/osdu/legal/logging/AuditEvents.java +++ b/legal-core/src/main/java/org/opengroup/osdu/legal/logging/AuditEvents.java @@ -82,25 +82,25 @@ public class AuditEvents { .build(); } - public AuditPayload getReadLegalPropertiesEventSuccess() { + public AuditPayload getReadLegalPropertiesEventSuccess(List<String> resources) { return AuditPayload.builder() .action(AuditAction.READ) .status(AuditStatus.SUCCESS) .user(this.user) .actionId(READ_ACTION_ID) .message(READ_MESSAGE_SUCCESS) - .resources(singletonList(PROPERTY_VALUE)) + .resources(resources) .build(); } - public AuditPayload getReadLegalPropertiesEventFail() { + public AuditPayload getReadLegalPropertiesEventFail(List<String> resources) { return AuditPayload.builder() .action(AuditAction.READ) .status(AuditStatus.FAILURE) .user(this.user) .actionId(READ_ACTION_ID) .message(READ_MESSAGE_FAILURE) - .resources(singletonList(PROPERTY_VALUE)) + .resources(resources) .build(); } diff --git a/legal-core/src/main/java/org/opengroup/osdu/legal/logging/AuditLogger.java b/legal-core/src/main/java/org/opengroup/osdu/legal/logging/AuditLogger.java index 8df60fb121d2ebd8211bc62d91eb717c3f6bdb2b..939b2cdd614a354ba70003a200c38c39d0ade8b9 100644 --- a/legal-core/src/main/java/org/opengroup/osdu/legal/logging/AuditLogger.java +++ b/legal-core/src/main/java/org/opengroup/osdu/legal/logging/AuditLogger.java @@ -63,12 +63,12 @@ public class AuditLogger { this.writeLog(this.getEvents().getLegalTagStatusJobEventFail(resources)); } - public void readLegalPropertiesSuccess() { - this.writeLog(this.getEvents().getReadLegalPropertiesEventSuccess()); + public void readLegalPropertiesSuccess(List<String> resources) { + this.writeLog(this.getEvents().getReadLegalPropertiesEventSuccess(resources)); } - public void readLegalPropertiesFail() { - this.writeLog(this.getEvents().getReadLegalPropertiesEventFail()); + public void readLegalPropertiesFail(List<String> resources) { + this.writeLog(this.getEvents().getReadLegalPropertiesEventFail(resources)); } public void validateLegalTagSuccess() { diff --git a/legal-core/src/test/java/org/opengroup/osdu/legal/api/LegalTagApiTests.java b/legal-core/src/test/java/org/opengroup/osdu/legal/api/LegalTagApiTests.java index a62d12e014ef4f0433afb7f35e7cfc3bf048cc3b..1d48b35939cbe10205d3ccedb952a77c1fab80ea 100644 --- a/legal-core/src/test/java/org/opengroup/osdu/legal/api/LegalTagApiTests.java +++ b/legal-core/src/test/java/org/opengroup/osdu/legal/api/LegalTagApiTests.java @@ -268,6 +268,6 @@ public class LegalTagApiTests { public void shouldCreateAuditLogs_when_getLegalTagProperties() { sut.getLegalTagProperties(); - verify(auditLogger).readLegalPropertiesSuccess(); + verify(auditLogger).readLegalPropertiesSuccess(any()); } } diff --git a/legal-core/src/test/java/org/opengroup/osdu/legal/logging/AuditLoggerTests.java b/legal-core/src/test/java/org/opengroup/osdu/legal/logging/AuditLoggerTests.java index aba5c74aa429660f0638161c58ba2dc8a69ea7d3..5d5220ea63cd65f4f5fb707d8ea5b30a886f70bd 100644 --- a/legal-core/src/test/java/org/opengroup/osdu/legal/logging/AuditLoggerTests.java +++ b/legal-core/src/test/java/org/opengroup/osdu/legal/logging/AuditLoggerTests.java @@ -67,13 +67,13 @@ public class AuditLoggerTests { @Test public void should_writeLegalTagReadPropertiesSuccessEvent(){ - sut.readLegalPropertiesSuccess(); + sut.readLegalPropertiesSuccess(any()); verify(log).audit(any()); } @Test public void should_writeLegalTagReadPropertiesFailEvent(){ - sut.readLegalPropertiesFail(); + sut.readLegalPropertiesFail(any()); verify(log).audit(any()); }