diff OrthancServer/Sources/main.cpp @ 4954:e1495a34cd39 more-tags

integration mainline->more-tags
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 22 Mar 2022 19:11:56 +0100
parents b7ce2bb6b881 47d734fa30f6
children e95fadefeb72
line wrap: on
line diff
--- a/OrthancServer/Sources/main.cpp	Mon Mar 21 15:19:42 2022 +0100
+++ b/OrthancServer/Sources/main.cpp	Tue Mar 22 19:11:56 2022 +0100
@@ -430,29 +430,53 @@
       }
       else
       {
-        // If there are multiple modalities with the same AET, consider the one matching this IP
+        // If there are multiple modalities with the same AET, consider the one matching this IP 
+        // or check if the operation is allowed for all modalities
+        bool allowedForAllModalities = true;
+
         for (std::list<RemoteModalityParameters>::const_iterator
                it = modalities.begin(); it != modalities.end(); ++it)
         {
-          if (it->GetHost() == remoteIp)
+          if (it->IsRequestAllowed(type))
           {
-            if (it->IsRequestAllowed(type))
+            if (checkIp &&
+                it->GetHost() == remoteIp)
             {
               return true;
             }
-            else
-            {
-              ReportDisallowedCommand(remoteIp, remoteAet, type);
-              return false;
-            }
+          }
+          else
+          {
+            allowedForAllModalities = false;
           }
         }
 
-        LOG(WARNING) << "DICOM authorization rejected for AET " << remoteAet
-                     << " on IP " << remoteIp << ": " << modalities.size()
-                     << " modalites found with this AET in configuration option "
-                     << "\"DicomModalities\", but none of them matches the IP";
-        return false;
+        if (allowedForAllModalities)
+        {
+          return true;
+        }
+        else
+        {
+          ReportDisallowedCommand(remoteIp, remoteAet, type);
+
+          if (checkIp)
+          {
+            LOG(WARNING) << "DICOM authorization rejected for AET " << remoteAet
+                         << " on IP " << remoteIp << ": " << modalities.size()
+                         << " modalites found with this AET in configuration option "
+                         << "\"DicomModalities\", but the operation is allowed for none "
+                         << "of them matching the IP";
+          }
+          else
+          {
+            LOG(WARNING) << "DICOM authorization rejected for AET " << remoteAet
+                         << " on IP " << remoteIp << ": " << modalities.size()
+                         << " modalites found with this AET in configuration option "
+                         << "\"DicomModalities\", but the operation is not allowed for"
+                         << "all of them";
+          }
+          return false;
+        }
       }
     }
   }
@@ -1157,6 +1181,13 @@
       }
     }
 
+#if ORTHANC_ENABLE_PLUGINS == 1
+    if (plugins != NULL)
+    {
+      plugins->RegisterWebDavCollections(httpServer);
+    }
+#endif
+
     MyHttpExceptionFormatter exceptionFormatter(httpDescribeErrors, plugins);
         
     httpServer.SetIncomingHttpRequestFilter(httpFilter);