Mercurial > hg > orthanc-authorization
diff Plugin/AccessedResource.cpp @ 109:7381a7674b36
wip: adding labels
author | Alain Mazy <am@osimis.io> |
---|---|
date | Fri, 18 Aug 2023 12:08:49 +0200 |
parents | 1a13c4fbc9a1 |
children | ba9d72ecdbc4 |
line wrap: on
line diff
--- a/Plugin/AccessedResource.cpp Mon Aug 14 10:25:40 2023 +0200 +++ b/Plugin/AccessedResource.cpp Fri Aug 18 12:08:49 2023 +0200 @@ -24,15 +24,17 @@ { AccessedResource::AccessedResource(AccessLevel level, const std::string& orthancId, - const std::string& dicomUid) : + const std::string& dicomUid, + const std::set<std::string>& labels) : level_(level), orthancId_(orthancId), - dicomUid_(dicomUid) + dicomUid_(dicomUid), + labels_(labels) { if (level_ == AccessLevel_System && - !dicomUid.empty()) + (!dicomUid.empty() || !labels.empty())) { - // The "DICOM UID" makes no sense for custom Orthanc URIs + // The "DICOM UID" and labels make no sense for custom Orthanc URIs throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); } } @@ -40,9 +42,11 @@ AccessedResource::AccessedResource(Orthanc::ResourceType level, const std::string& orthancId, - const std::string& dicomUid) : + const std::string& dicomUid, + const std::set<std::string>& labels) : orthancId_(orthancId), - dicomUid_(dicomUid) + dicomUid_(dicomUid), + labels_(labels) { switch (level) { @@ -79,4 +83,17 @@ return dicomUid_; } } + + const std::set<std::string>& AccessedResource::GetLabels() const + { + if (level_ == AccessLevel_System) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); + } + else + { + return labels_; + } + } + }