changeset 103:fcc4542a0c38

cleanup
author Alain Mazy <am@osimis.io>
date Tue, 20 Jun 2023 15:16:26 +0200
parents 18d3f7bd18db
children 23f3d22ae04d
files Plugin/Plugin.cpp
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Plugin/Plugin.cpp	Tue Jun 20 09:22:41 2023 +0200
+++ b/Plugin/Plugin.cpp	Tue Jun 20 15:16:26 2023 +0200
@@ -147,30 +147,33 @@
       {
         if (authTokens.empty())
         {
-          LOG(INFO) << "Testing whether anonymous user has any of the required permissions '" << JoinStrings(requiredPermissions) << "'";
+          std::string msg = std::string("Testing whether anonymous user has any of the required permissions '") + JoinStrings(requiredPermissions) + "'";
+          LOG(INFO) << msg;
           if (authorizationService_->HasAnonymousUserPermission(validity, requiredPermissions))
           {
-            LOG(INFO) << "Testing whether anonymous user has any of the required permissions '" << JoinStrings(requiredPermissions) << "' -> granted";
+            LOG(INFO) << msg << " -> granted";
             return 1;
           }
           else
           {
-            LOG(INFO) << "Testing whether anonymous user has any of the required permissions '" << JoinStrings(requiredPermissions) << "' -> not granted";
+            LOG(INFO) << msg << " -> not granted";
           }
         }
         else
         {
           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].GetToken().GetKey() << "' HTTP header required to match '" << matchedPattern << "'";
+            std::string msg = std::string("Testing whether user has the required permissions '") + JoinStrings(requiredPermissions) + "' based on the HTTP header '" + authTokens[i].GetToken().GetKey() + "' required to match '" + matchedPattern + "'";
+
+            LOG(INFO) << msg;
             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].GetToken().GetKey() << "' HTTP header required to match '" << matchedPattern << "' -> granted";
+              LOG(INFO) << msg << " -> granted";
               return 1;
             }
             else
             {
-              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";
+              LOG(INFO) << msg << " -> not granted";
             }
           }
         }