changeset 311:ac89820c43b2

fix audit logs for zip uploads
author Alain Mazy <am@orthanc.team>
date Mon, 12 Jan 2026 19:28:52 +0100
parents b4bf2767a829
children 773185dc4db4
files NEWS Plugin/Plugin.cpp
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Fri Jan 02 13:00:15 2026 +0100
+++ b/NEWS	Mon Jan 12 19:28:52 2026 +0100
@@ -1,3 +1,8 @@
+Pending changes in the mainline
+===============================
+
+* Now recording audit-logs when uploading a zip.
+
 2025-11-20 - v 0.10.3
 =====================
 
--- a/Plugin/Plugin.cpp	Fri Jan 02 13:00:15 2026 +0100
+++ b/Plugin/Plugin.cpp	Mon Jan 12 19:28:52 2026 +0100
@@ -1225,7 +1225,17 @@
 
     if (GetUserProfileInternal(profile, request) && coreApi.GetAnswerJson(coreResponse))
     {
-      RecordAuditLog(profile.userId, OrthancPluginResourceType_Study, coreResponse["ParentStudy"].asString(), "uploaded-instance", coreResponse["ID"].asString());
+      if (coreResponse.isArray())
+      {
+        for (Json::ArrayIndex i = 0; i < coreResponse.size(); ++i)
+        {
+          RecordAuditLog(profile.userId, OrthancPluginResourceType_Study, coreResponse[i]["ParentStudy"].asString(), "uploaded-instance", coreResponse[i]["ID"].asString());
+        }
+      }
+      else if (coreResponse["ID"].isString())
+      {
+        RecordAuditLog(profile.userId, OrthancPluginResourceType_Study, coreResponse["ParentStudy"].asString(), "uploaded-instance", coreResponse["ID"].asString());
+      }
     }
     else
     {