diff Plugin/Plugin.cpp @ 138:f448e8626f1a

Now handling new GET /tools/create-archive and sibling routes
author Alain Mazy <am@osimis.io>
date Sat, 25 Nov 2023 12:18:14 +0100
parents 8b123c2adb69
children 423531fb1200
line wrap: on
line diff
--- a/Plugin/Plugin.cpp	Fri Nov 24 15:37:52 2023 +0100
+++ b/Plugin/Plugin.cpp	Sat Nov 25 12:18:14 2023 +0100
@@ -378,14 +378,26 @@
 
       // Loop over all the accessed resources to ensure access is
       // granted to each of them
+      int checkedResources = 0;
+      int grantedResources = 0;
+
       for (OrthancPlugins::IAuthorizationParser::AccessedResources::const_iterator
              access = accesses.begin(); access != accesses.end(); ++access)
       {
-        if (IsResourceAccessGranted(authTokens, method, *access))
+        if (uncheckedLevels_.find(access->GetLevel()) == uncheckedLevels_.end())
         {
-          return 1;
+          checkedResources++;
+          if (IsResourceAccessGranted(authTokens, method, *access))
+          {
+            grantedResources++;
+          }  
         }
       }
+
+      if (checkedResources > 0 && grantedResources == checkedResources)
+      {
+        return 1;
+      }
     }
       
     // By default, forbid access to all the resources