diff OrthancServer/OrthancRestApi/OrthancRestResources.cpp @ 2940:4767d36679ed

refactoring access to Orthanc configuration
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 29 Nov 2018 11:47:00 +0100
parents aeeb40a35ce1
children bbfd95a0c429
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Wed Nov 28 14:48:14 2018 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Thu Nov 29 11:47:00 2018 +0100
@@ -39,7 +39,7 @@
 #include "../../Core/DicomParsing/Internals/DicomImageDecoder.h"
 #include "../../Core/HttpServer/HttpContentNegociation.h"
 #include "../../Core/Logging.h"
-#include "../OrthancInitialization.h"
+#include "../OrthancConfiguration.h"
 #include "../Search/LookupResource.h"
 #include "../ServerContext.h"
 #include "../ServerToolbox.h"
@@ -987,17 +987,22 @@
     {
       allowed = true;
     }
-    else if (Configuration::GetGlobalBoolParameter("StoreDicom", true) &&
-             contentType == FileContentType_DicomAsJson)
-    {
-      allowed = true;
-    }
     else
     {
-      // It is forbidden to delete internal attachments, except for
-      // the "DICOM as JSON" summary as of Orthanc 1.2.0 (this summary
-      // would be automatically reconstructed on the next GET call)
-      allowed = false;
+      OrthancConfiguration::ReaderLock lock;
+
+      if (lock.GetConfiguration().GetBooleanParameter("StoreDicom", true) &&
+          contentType == FileContentType_DicomAsJson)
+      {
+        allowed = true;
+      }
+      else
+      {
+        // It is forbidden to delete internal attachments, except for
+        // the "DICOM as JSON" summary as of Orthanc 1.2.0 (this summary
+        // would be automatically reconstructed on the next GET call)
+        allowed = false;
+      }
     }
 
     if (allowed)