changeset 86:e2c3c497eb8d 0.5.0

fix LSB build
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 17 Mar 2023 18:52:45 +0100
parents 9db6b2ed930c
children 65950b86437b 6155c23df542
files CMakeLists.txt Plugin/AuthorizationWebService.cpp Plugin/Plugin.cpp
diffstat 3 files changed, 25 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Fri Mar 17 17:02:09 2023 +0100
+++ b/CMakeLists.txt	Fri Mar 17 18:52:45 2023 +0100
@@ -25,7 +25,7 @@
   set(ORTHANC_FRAMEWORK_VERSION "mainline")
   set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
 else()
-  set(ORTHANC_FRAMEWORK_VERSION "1.9.3")
+  set(ORTHANC_FRAMEWORK_VERSION "1.11.3")
   set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
 endif()
 
@@ -204,4 +204,4 @@
 target_link_libraries(UnitTests
   ${GOOGLE_TEST_LIBRARIES}
   # ${AUTOGENERATED_SOURCES}
-  )
\ No newline at end of file
+  )
--- a/Plugin/AuthorizationWebService.cpp	Fri Mar 17 17:02:09 2023 +0100
+++ b/Plugin/AuthorizationWebService.cpp	Fri Mar 17 18:52:45 2023 +0100
@@ -282,7 +282,7 @@
     }
     if (validityDuration > 0)
     {
-      body["validity-duration"] = validityDuration;
+      body["validity-duration"] = Json::UInt64(validityDuration);
     }
 
     std::string bodyAsString;
--- a/Plugin/Plugin.cpp	Fri Mar 17 17:02:09 2023 +0100
+++ b/Plugin/Plugin.cpp	Fri Mar 17 18:52:45 2023 +0100
@@ -49,15 +49,27 @@
   return out;
 }
 
-struct TokenAndValue
+class TokenAndValue
 {
-  const OrthancPlugins::Token& token;
-  std::string value;
+private:
+  OrthancPlugins::Token token_;
+  std::string value_;
 
+public:
   TokenAndValue(const OrthancPlugins::Token& token, const std::string& value) :
-    token(token),
-    value(value)
+    token_(token),
+    value_(value)
+  {
+  }
+
+  const OrthancPlugins::Token& GetToken() const
   {
+    return token_;
+  }
+
+  const std::string& GetValue() const
+  {
+    return value_;
   }
 };
 
@@ -150,15 +162,15 @@
         {
           for (size_t i = 0; i < authTokens.size(); ++i)
           {
-            LOG(INFO) << "Testing whether user has the required permission '" << JoinStrings(requiredPermissions) << "' based on the '" << authTokens[i].token.GetKey() << "' HTTP header required to match '" << matchedPattern << "'";
-            if (authorizationService_->HasUserPermission(validity, requiredPermissions, authTokens[i].token, authTokens[i].value))
+            LOG(INFO) << "Testing whether user has the required permission '" << JoinStrings(requiredPermissions) << "' based on the '" << authTokens[i].GetToken().GetKey() << "' HTTP header required to match '" << matchedPattern << "'";
+            if (authorizationService_->HasUserPermission(validity, requiredPermissions, authTokens[i].GetToken(), authTokens[i].GetValue()))
             {
-              LOG(INFO) << "Testing whether user has the required permission '" << JoinStrings(requiredPermissions) << "' based on the '" << authTokens[i].token.GetKey() << "' HTTP header required to match '" << matchedPattern << "' -> granted";
+              LOG(INFO) << "Testing whether user has the required permission '" << JoinStrings(requiredPermissions) << "' based on the '" << authTokens[i].GetToken().GetKey() << "' HTTP header required to match '" << matchedPattern << "' -> granted";
               return 1;
             }
             else
             {
-              LOG(INFO) << "Testing whether user has the required permission '" << JoinStrings(requiredPermissions) << "' based on the '" << authTokens[i].token.GetKey() << "' HTTP header required to match '" << matchedPattern << "' -> not granted";
+              LOG(INFO) << "Testing whether user has the required permission '" << JoinStrings(requiredPermissions) << "' based on the '" << authTokens[i].GetToken().GetKey() << "' HTTP header required to match '" << matchedPattern << "' -> not granted";
             }
           }
         }
@@ -198,7 +210,7 @@
             // Loop over all the authorization tokens in the request until finding one that is granted
             for (size_t i = 0; i < authTokens.size(); ++i)
             {
-              if (authorizationService_->IsGranted(validity, method, *access, authTokens[i].token, authTokens[i].value))
+              if (authorizationService_->IsGranted(validity, method, *access, authTokens[i].GetToken(), authTokens[i].GetValue()))
               {
                 granted = true;
                 break;