Mercurial > hg > orthanc
comparison OrthancServer/Sources/OrthancFindRequestHandler.cpp @ 5058:d4e5ca0c9307
Fix the "Never" option of the "StorageAccessOnFind" that was sill accessing files (bug introduced in 1.11.0)
author | Alain Mazy <am@osimis.io> |
---|---|
date | Wed, 03 Aug 2022 10:49:50 +0200 |
parents | 2cfa50d8eb60 |
children | 0ea402b4d901 |
comparison
equal
deleted
inserted
replaced
5057:e6f26be401fa | 5058:d4e5ca0c9307 |
---|---|
47 ResourceType level, | 47 ResourceType level, |
48 const DicomArray& query, | 48 const DicomArray& query, |
49 const std::list<DicomTag>& sequencesToReturn, | 49 const std::list<DicomTag>& sequencesToReturn, |
50 const std::string& defaultPrivateCreator, | 50 const std::string& defaultPrivateCreator, |
51 const std::map<uint16_t, std::string>& privateCreators, | 51 const std::map<uint16_t, std::string>& privateCreators, |
52 const std::string& retrieveAet) | 52 const std::string& retrieveAet, |
53 bool allowStorageAccess) | |
53 { | 54 { |
54 ExpandedResource resource; | 55 ExpandedResource resource; |
55 std::set<DicomTag> requestedTags; | 56 std::set<DicomTag> requestedTags; |
56 | 57 |
57 query.GetTags(requestedTags); | 58 query.GetTags(requestedTags); |
58 requestedTags.erase(DICOM_TAG_QUERY_RETRIEVE_LEVEL); // this is not part of the answer | 59 requestedTags.erase(DICOM_TAG_QUERY_RETRIEVE_LEVEL); // this is not part of the answer |
59 | 60 |
60 // reuse ExpandResource to get missing tags and computed tags (ModalitiesInStudy ...). This code is therefore shared between C-Find, tools/find, list-resources and QIDO-RS | 61 // reuse ExpandResource to get missing tags and computed tags (ModalitiesInStudy ...). This code is therefore shared between C-Find, tools/find, list-resources and QIDO-RS |
61 context.ExpandResource(resource, publicId, mainDicomTags, instanceId, dicomAsJson, level, requestedTags, ExpandResourceDbFlags_IncludeMainDicomTags); | 62 context.ExpandResource(resource, publicId, mainDicomTags, instanceId, dicomAsJson, level, requestedTags, ExpandResourceDbFlags_IncludeMainDicomTags, allowStorageAccess); |
62 | 63 |
63 DicomMap result; | 64 DicomMap result; |
64 | 65 |
65 /** | 66 /** |
66 * Add the mandatory "Retrieve AE Title (0008,0054)" tag, which was missing in Orthanc <= 1.7.2. | 67 * Add the mandatory "Retrieve AE Title (0008,0054)" tag, which was missing in Orthanc <= 1.7.2. |
244 DicomArray queryAsArray_; | 245 DicomArray queryAsArray_; |
245 const std::list<DicomTag>& sequencesToReturn_; | 246 const std::list<DicomTag>& sequencesToReturn_; |
246 std::string defaultPrivateCreator_; // the private creator to use if the group is not defined in the query itself | 247 std::string defaultPrivateCreator_; // the private creator to use if the group is not defined in the query itself |
247 const std::map<uint16_t, std::string>& privateCreators_; // the private creators defined in the query itself | 248 const std::map<uint16_t, std::string>& privateCreators_; // the private creators defined in the query itself |
248 std::string retrieveAet_; | 249 std::string retrieveAet_; |
250 FindStorageAccessMode findStorageAccessMode_; | |
249 | 251 |
250 public: | 252 public: |
251 LookupVisitor(DicomFindAnswers& answers, | 253 LookupVisitor(DicomFindAnswers& answers, |
252 ServerContext& context, | 254 ServerContext& context, |
253 ResourceType level, | 255 ResourceType level, |
254 const DicomMap& query, | 256 const DicomMap& query, |
255 const std::list<DicomTag>& sequencesToReturn, | 257 const std::list<DicomTag>& sequencesToReturn, |
256 const std::map<uint16_t, std::string>& privateCreators) : | 258 const std::map<uint16_t, std::string>& privateCreators, |
259 FindStorageAccessMode findStorageAccessMode) : | |
257 answers_(answers), | 260 answers_(answers), |
258 context_(context), | 261 context_(context), |
259 level_(level), | 262 level_(level), |
260 query_(query), | 263 query_(query), |
261 queryAsArray_(query), | 264 queryAsArray_(query), |
262 sequencesToReturn_(sequencesToReturn), | 265 sequencesToReturn_(sequencesToReturn), |
263 privateCreators_(privateCreators) | 266 privateCreators_(privateCreators), |
267 findStorageAccessMode_(findStorageAccessMode) | |
264 { | 268 { |
265 answers_.SetComplete(false); | 269 answers_.SetComplete(false); |
266 | 270 |
267 { | 271 { |
268 OrthancConfiguration::ReaderLock lock; | 272 OrthancConfiguration::ReaderLock lock; |
306 const std::string& instanceId, | 310 const std::string& instanceId, |
307 const DicomMap& mainDicomTags, | 311 const DicomMap& mainDicomTags, |
308 const Json::Value* dicomAsJson) ORTHANC_OVERRIDE | 312 const Json::Value* dicomAsJson) ORTHANC_OVERRIDE |
309 { | 313 { |
310 AddAnswer(answers_, context_, publicId, instanceId, mainDicomTags, dicomAsJson, level_, queryAsArray_, sequencesToReturn_, | 314 AddAnswer(answers_, context_, publicId, instanceId, mainDicomTags, dicomAsJson, level_, queryAsArray_, sequencesToReturn_, |
311 defaultPrivateCreator_, privateCreators_, retrieveAet_); | 315 defaultPrivateCreator_, privateCreators_, retrieveAet_, IsStorageAccessAllowedForAnswers(findStorageAccessMode_)); |
312 } | 316 } |
313 }; | 317 }; |
314 | 318 |
315 | 319 |
316 void OrthancFindRequestHandler::Handle(DicomFindAnswers& answers, | 320 void OrthancFindRequestHandler::Handle(DicomFindAnswers& answers, |
476 **/ | 480 **/ |
477 | 481 |
478 size_t limit = (level == ResourceType_Instance) ? maxInstances_ : maxResults_; | 482 size_t limit = (level == ResourceType_Instance) ? maxInstances_ : maxResults_; |
479 | 483 |
480 | 484 |
481 LookupVisitor visitor(answers, context_, level, *filteredInput, sequencesToReturn, privateCreators); | 485 LookupVisitor visitor(answers, context_, level, *filteredInput, sequencesToReturn, privateCreators, context_.GetFindStorageAccessMode()); |
482 context_.Apply(visitor, lookup, level, 0 /* "since" is not relevant to C-FIND */, limit); | 486 context_.Apply(visitor, lookup, level, 0 /* "since" is not relevant to C-FIND */, limit); |
483 } | 487 } |
484 | 488 |
485 | 489 |
486 void OrthancFindRequestHandler::FormatOrigin(Json::Value& origin, | 490 void OrthancFindRequestHandler::FormatOrigin(Json::Value& origin, |