Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
2939:577786f59252 | 2940:4767d36679ed |
---|---|
37 #include "../../Core/Compression/GzipCompressor.h" | 37 #include "../../Core/Compression/GzipCompressor.h" |
38 #include "../../Core/DicomParsing/FromDcmtkBridge.h" | 38 #include "../../Core/DicomParsing/FromDcmtkBridge.h" |
39 #include "../../Core/DicomParsing/Internals/DicomImageDecoder.h" | 39 #include "../../Core/DicomParsing/Internals/DicomImageDecoder.h" |
40 #include "../../Core/HttpServer/HttpContentNegociation.h" | 40 #include "../../Core/HttpServer/HttpContentNegociation.h" |
41 #include "../../Core/Logging.h" | 41 #include "../../Core/Logging.h" |
42 #include "../OrthancInitialization.h" | 42 #include "../OrthancConfiguration.h" |
43 #include "../Search/LookupResource.h" | 43 #include "../Search/LookupResource.h" |
44 #include "../ServerContext.h" | 44 #include "../ServerContext.h" |
45 #include "../ServerToolbox.h" | 45 #include "../ServerToolbox.h" |
46 #include "../SliceOrdering.h" | 46 #include "../SliceOrdering.h" |
47 | 47 |
985 bool allowed; | 985 bool allowed; |
986 if (IsUserContentType(contentType)) | 986 if (IsUserContentType(contentType)) |
987 { | 987 { |
988 allowed = true; | 988 allowed = true; |
989 } | 989 } |
990 else if (Configuration::GetGlobalBoolParameter("StoreDicom", true) && | |
991 contentType == FileContentType_DicomAsJson) | |
992 { | |
993 allowed = true; | |
994 } | |
995 else | 990 else |
996 { | 991 { |
997 // It is forbidden to delete internal attachments, except for | 992 OrthancConfiguration::ReaderLock lock; |
998 // the "DICOM as JSON" summary as of Orthanc 1.2.0 (this summary | 993 |
999 // would be automatically reconstructed on the next GET call) | 994 if (lock.GetConfiguration().GetBooleanParameter("StoreDicom", true) && |
1000 allowed = false; | 995 contentType == FileContentType_DicomAsJson) |
996 { | |
997 allowed = true; | |
998 } | |
999 else | |
1000 { | |
1001 // It is forbidden to delete internal attachments, except for | |
1002 // the "DICOM as JSON" summary as of Orthanc 1.2.0 (this summary | |
1003 // would be automatically reconstructed on the next GET call) | |
1004 allowed = false; | |
1005 } | |
1001 } | 1006 } |
1002 | 1007 |
1003 if (allowed) | 1008 if (allowed) |
1004 { | 1009 { |
1005 OrthancRestApi::GetIndex(call).DeleteAttachment(publicId, contentType); | 1010 OrthancRestApi::GetIndex(call).DeleteAttachment(publicId, contentType); |