comparison Plugin/DefaultAuthorizationParser.cpp @ 56:c02f0646297d

added support for /dicom-web/studies?0020000D=1.2.3&...
author Alain Mazy <am@osimis.io>
date Tue, 08 Nov 2022 16:10:22 +0100
parents 9ed19ec11f48
children 55539d564f4f
comparison
equal deleted inserted replaced
54:317b31e99501 56:c02f0646297d
17 **/ 17 **/
18 18
19 #include "DefaultAuthorizationParser.h" 19 #include "DefaultAuthorizationParser.h"
20 20
21 #include <OrthancException.h> 21 #include <OrthancException.h>
22 #include <HttpServer/HttpToolbox.h>
22 23
23 namespace OrthancPlugins 24 namespace OrthancPlugins
24 { 25 {
25 DefaultAuthorizationParser::DefaultAuthorizationParser(ICacheFactory& factory, 26 DefaultAuthorizationParser::DefaultAuthorizationParser(ICacheFactory& factory,
26 const std::string& dicomWebRoot) : 27 const std::string& dicomWebRoot) :
45 dicomWebSeries_ = boost::regex( 46 dicomWebSeries_ = boost::regex(
46 "^" + tmp + "/studies/([.0-9]+)/series/([.0-9]+)(|/instances)(|/)$"); 47 "^" + tmp + "/studies/([.0-9]+)/series/([.0-9]+)(|/instances)(|/)$");
47 48
48 dicomWebInstances_ = boost::regex( 49 dicomWebInstances_ = boost::regex(
49 "^" + tmp + "/studies/([.0-9]+)/series/([.0-9]+)/instances/([.0-9]+)(|/|/frames/.*)$"); 50 "^" + tmp + "/studies/([.0-9]+)/series/([.0-9]+)/instances/([.0-9]+)(|/|/frames/.*)$");
51
52 dicomWebQidoRsFindStudies_ = boost::regex(
53 "^" + tmp + "/studies\?(.*)$");
50 } 54 }
51 55
52 56
53 bool DefaultAuthorizationParser::Parse(AccessedResources& target, 57 bool DefaultAuthorizationParser::Parse(AccessedResources& target,
54 const std::string& uri) 58 const std::string& uri,
59 const std::map<std::string, std::string>& getArguments)
55 { 60 {
56 // The mutex below should not be necessary, but we prefer to 61 // The mutex below should not be necessary, but we prefer to
57 // ensure thread safety in boost::regex 62 // ensure thread safety in boost::regex
58 boost::mutex::scoped_lock lock(mutex_); 63 boost::mutex::scoped_lock lock(mutex_);
59 64
125 else if (boost::regex_match(uri, what, osimisViewerImages_)) 130 else if (boost::regex_match(uri, what, osimisViewerImages_))
126 { 131 {
127 AddOrthancInstance(target, what[2]); 132 AddOrthancInstance(target, what[2]);
128 return true; 133 return true;
129 } 134 }
135 else if (boost::regex_match(uri, what, dicomWebQidoRsFindStudies_))
136 {
137 std::string studyInstanceUid;
138
139 studyInstanceUid = Orthanc::HttpToolbox::GetArgument(getArguments, "0020000D", "");
140
141 if (!studyInstanceUid.empty())
142 {
143 AddDicomStudy(target, studyInstanceUid);
144 }
145 return true;
146 }
130 else 147 else
131 { 148 {
132 // Unknown type of resource: Consider it as a system access 149 // Unknown type of resource: Consider it as a system access
133 150
134 // Remove the trailing slashes if need be 151 // Remove the trailing slashes if need be