You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2025/02/28 14:54:35 UTC

(ofbiz-framework) branch release18.12 updated: Improved: Refactor ControlFilter class without functional changes (OFBIZ-13213)

This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release18.12 by this push:
     new 5c725123d2 Improved: Refactor ControlFilter class without functional changes (OFBIZ-13213)
5c725123d2 is described below

commit 5c725123d2e1dbdb0c959e597e4af44a24dce17b
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Fri Feb 28 15:51:45 2025 +0100

    Improved: Refactor ControlFilter class without functional changes (OFBIZ-13213)
    
    Better groups the functionalities and comment them for an easier readability
---
 .../main/java/org/apache/ofbiz/webapp/control/ControlFilter.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlFilter.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlFilter.java
index badda5d9fc..fc587dce28 100644
--- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlFilter.java
+++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlFilter.java
@@ -113,7 +113,7 @@ public class ControlFilter implements Filter {
         }
     }
 
-    private static boolean isSolrTest() {
+    private static boolean isSolrTest() { // Allows Solr tests
         return !GenericValue.getStackTraceAsString().contains("ControlFilterTests")
                 && null == System.getProperty("SolrDispatchFilter");
     }
@@ -194,10 +194,13 @@ public class ControlFilter implements Filter {
                 offset = requestUri.length();
             }
 
+            if (SecurityUtil.containsFreemarkerInterpolation(httpRequest, httpResponse, requestUri)) {
+                return;
+            }
+
             GenericValue userLogin = (GenericValue) httpRequest.getSession().getAttribute("userLogin");
             if (!LoginWorker.hasBasePermission(userLogin, httpRequest)) { // Allows UEL and FlexibleString (OFBIZ-12602)
-                if (isSolrTest() // Allows Solr tests
-                    && SecurityUtil.containsFreemarkerInterpolation(httpRequest, httpResponse, requestUri)) {
+                if (isSolrTest()) {
                     return;
                 }
             }