diff OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp @ 3709:1f4910999fe7

Fix issue #168 (Plugins can't read private tags from the configuration file)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 28 Feb 2020 13:23:11 +0100
parents 4922bdd046dd
children 2a170a8f1faf
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Fri Feb 28 11:53:23 2020 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Fri Feb 28 13:23:11 2020 +0100
@@ -37,6 +37,7 @@
 #include "../../Core/DicomParsing/FromDcmtkBridge.h"
 #include "../../Core/Logging.h"
 #include "../../Core/SerializationToolbox.h"
+#include "../OrthancConfiguration.h"
 #include "../ServerContext.h"
 #include "../ServerJobs/MergeStudyJob.h"
 #include "../ServerJobs/ResourceModificationJob.h"
@@ -63,6 +64,11 @@
   {
     // curl http://localhost:8042/series/95a6e2bf-9296e2cc-bf614e2f-22b391ee-16e010e0/modify -X POST -d '{"Replace":{"InstitutionName":"My own clinic"},"Priority":9}'
 
+    {
+      OrthancConfiguration::ReaderLock lock;
+      target.SetPrivateCreator(lock.GetConfiguration().GetDefaultPrivateCreator());
+    }
+    
     if (call.ParseJsonRequest(request))
     {
       target.ParseModifyRequest(request);
@@ -80,6 +86,11 @@
   {
     // curl http://localhost:8042/instances/6e67da51-d119d6ae-c5667437-87b9a8a5-0f07c49f/anonymize -X POST -d '{"Replace":{"PatientName":"hello","0010-0020":"world"},"Keep":["StudyDescription", "SeriesDescription"],"KeepPrivateTags": true,"Remove":["Modality"]}' > Anonymized.dcm
 
+    {
+      OrthancConfiguration::ReaderLock lock;
+      target.SetPrivateCreator(lock.GetConfiguration().GetDefaultPrivateCreator());
+    }
+    
     if (call.ParseJsonRequest(request) &&
         request.isObject())
     {
@@ -553,6 +564,11 @@
 
       privateCreator = v.asString();
     }
+    else
+    {
+      OrthancConfiguration::ReaderLock lock;
+      privateCreator = lock.GetConfiguration().GetDefaultPrivateCreator();
+    }
 
     
     // Inject time-related information