# HG changeset patch # User Alain Mazy # Date 1714051824 -7200 # Node ID 4f5c7acb626ffbf79bdd9bf5402823227c2d77e4 # Parent db1a5d1634e0021839849049b1918f87aa4c6207 more detailed error message diff -r db1a5d1634e0 -r 4f5c7acb626f Plugin/Plugin.cpp --- a/Plugin/Plugin.cpp Thu Apr 25 15:26:35 2024 +0200 +++ b/Plugin/Plugin.cpp Thu Apr 25 15:30:24 2024 +0200 @@ -715,10 +715,14 @@ { // since this is a series/instance find, make sure the user has access to the parent study Json::Value studyOrthancIds; - if (!OrthancPlugins::RestApiPost(studyOrthancIds, "/tools/lookup", studyInstanceUID, false) || studyOrthancIds.size() != 1) + if (!OrthancPlugins::RestApiPost(studyOrthancIds, "/tools/lookup", studyInstanceUID, false)) { throw Orthanc::OrthancException(Orthanc::ErrorCode_ForbiddenAccess, "Auth plugin: when using tools/find at Series or Instance level, unable to get the orthanc ID of StudyInstanceUID specified in the query."); } + else if (studyOrthancIds.size() != 1) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_ForbiddenAccess, "Auth plugin: when using tools/find at Series or Instance level, unable to get the orthanc ID of StudyInstanceUID specified in the query. Found " + boost::lexical_cast(studyOrthancIds.size()) + " orthanc studies with this StudyInstanceUID"); + } bool granted = false; OrthancPlugins::IAuthorizationParser::AccessedResources accessedResources; @@ -749,10 +753,14 @@ } Json::Value studyOrthancIds; - if (!OrthancPlugins::RestApiPost(studyOrthancIds, "/tools/lookup", studyInstanceUID, false) || studyOrthancIds.size() != 1) + if (!OrthancPlugins::RestApiPost(studyOrthancIds, "/tools/lookup", studyInstanceUID, false)) { throw Orthanc::OrthancException(Orthanc::ErrorCode_ForbiddenAccess, "Auth plugin: when using tools/find with a resource token, unable to get the orthanc ID of StudyInstanceUID specified in the query."); } + else if (studyOrthancIds.size() != 1) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_ForbiddenAccess, "Auth plugin: when using tools/find with a resource token, unable to get the orthanc ID of StudyInstanceUID specified in the query. Found " + boost::lexical_cast(studyOrthancIds.size()) + " orthanc studies with this StudyInstanceUID"); + } std::vector authTokens; // the tokens that are set in this request GetAuthTokens(authTokens, request->headersCount, request->headersKeys, request->headersValues, request->getCount, request->getKeys, request->getValues);