diff Plugin/Plugin.cpp @ 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 1c91a1cbbc35
children dff72e397f90
line wrap: on
line diff
--- 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;