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

hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new 7c1d07db7d Allow disabledGuiElements to be placed in root folder, 
fixes #5872 (#5873)
7c1d07db7d is described below

commit 7c1d07db7d1f0d0c563a1d5a106bbc5cac668306
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Thu Oct 23 13:20:19 2025 +0200

    Allow disabledGuiElements to be placed in root folder, fixes #5872 (#5873)
---
 .../static/src/main/resources/translator.xml       | 49 ----------------------
 .../modules/ROOT/pages/disable-ui-elements.adoc    |  2 +-
 .../main/java/org/apache/hop/ui/hopgui/HopGui.java | 36 ++++++++++++----
 .../apache/hop/ui/hopgui/HopGuiEnvironment.java    | 35 ++++++++++++----
 4 files changed, 58 insertions(+), 64 deletions(-)

diff --git a/assemblies/static/src/main/resources/translator.xml 
b/assemblies/static/src/main/resources/translator.xml
deleted file mode 100644
index a412503179..0000000000
--- a/assemblies/static/src/main/resources/translator.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  ~
-  -->
-
-<translator-config>
-    <reference-locale>en_US</reference-locale>
-    <locale-list>
-        <locale>en_US</locale>
-        <locale>de_DE</locale>
-        <locale>fr_FR</locale>
-        <locale>it_IT</locale>
-        <locale>zh_CN</locale>
-        <locale>ja_JP</locale>
-        <locale>ko_KR</locale>
-        <locale>nl_NL</locale>
-        <locale>pt_PT</locale>
-        <locale>pt_BR</locale>
-        <locale>no_NO</locale>
-        <locale>es_ES</locale>
-        <locale>es_AR</locale>
-    </locale-list>
-
-    <root-folder>../../../</root-folder>
-    <folders-to-avoid>.*archive.*</folders-to-avoid>
-
-    <files-to-avoid>
-        <filename>MessagesSourceCrawler.java</filename>
-        <filename>BaseTransformMeta.java</filename>
-        <filename>BasePluginType.java</filename>
-        <filename>ConfigurationDialog.java</filename>
-        <filename>Const.java</filename>
-        <filename>DatabaseFactory.java</filename>
-    </files-to-avoid>
-
-</translator-config>
\ No newline at end of file
diff --git a/docs/hop-tech-manual/modules/ROOT/pages/disable-ui-elements.adoc 
b/docs/hop-tech-manual/modules/ROOT/pages/disable-ui-elements.adoc
index 570b7ba1b0..d47b0c0935 100644
--- a/docs/hop-tech-manual/modules/ROOT/pages/disable-ui-elements.adoc
+++ b/docs/hop-tech-manual/modules/ROOT/pages/disable-ui-elements.adoc
@@ -22,7 +22,7 @@ under the License.
 Apache Hop has a system to disable UI elements and perspective.
 This could be useful for managed instances where the user should not have full 
control of Hop.
 
-You can add the following file to the Hop Config location by default 
`/hop/config` or when used the  `HOP_CONFIG_FOLDER` environment variable.
+You can add the following file to the Hop installation folder or your Hop 
Config location (default: `/hop/config`). The final list of disabled UI 
elements is the aggregation of both files. This allows you to remove GUI 
elements on a global level (Hop Installation) and extend it with specific 
excludes for specific users (on config level).
 
 Add the following file: +
 disabledGuiElements.xml
diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/HopGui.java 
b/ui/src/main/java/org/apache/hop/ui/hopgui/HopGui.java
index 67f1a9dca6..fe677b717a 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/HopGui.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/HopGui.java
@@ -35,6 +35,8 @@ import lombok.Getter;
 import lombok.Setter;
 import org.apache.commons.io.output.TeeOutputStream;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.vfs2.FileObject;
+import org.apache.commons.vfs2.FileSystemException;
 import org.apache.hop.core.Const;
 import org.apache.hop.core.DbCache;
 import org.apache.hop.core.HopEnvironment;
@@ -43,6 +45,7 @@ import 
org.apache.hop.core.config.DescribedVariablesConfigFile;
 import org.apache.hop.core.config.HopConfig;
 import org.apache.hop.core.database.DatabaseMeta;
 import org.apache.hop.core.exception.HopException;
+import org.apache.hop.core.exception.HopFileException;
 import org.apache.hop.core.exception.HopXmlException;
 import org.apache.hop.core.extension.ExtensionPointHandler;
 import org.apache.hop.core.extension.HopExtensionPoint;
@@ -70,6 +73,7 @@ import org.apache.hop.core.util.TranslateUtil;
 import org.apache.hop.core.variables.DescribedVariable;
 import org.apache.hop.core.variables.IVariables;
 import org.apache.hop.core.variables.Variables;
+import org.apache.hop.core.vfs.HopVfs;
 import org.apache.hop.core.xml.XmlHandler;
 import org.apache.hop.i18n.BaseMessages;
 import org.apache.hop.i18n.LanguageChoice;
@@ -514,16 +518,34 @@ public class HopGui
 
     // Try loading code exclusions
     try {
-      String path = Const.HOP_CONFIG_FOLDER + File.separator + 
"disabledGuiElements.xml";
+      FileObject applicationFolderFile = 
HopVfs.getFileObject("./disabledGuiElements.xml");
+      FileObject configFolderFile =
+          HopVfs.getFileObject(
+              Const.HOP_CONFIG_FOLDER + File.separator + 
"disabledGuiElements.xml");
+      String path = null;
+
+      if (applicationFolderFile.exists()) {
+        path = applicationFolderFile.getPath().toAbsolutePath().toString();
+        Document document = XmlHandler.loadXmlFile(path);
+        Node exclusionsNode = XmlHandler.getSubNode(document, "exclusions");
+        List<Node> exclusionNodes = XmlHandler.getNodes(exclusionsNode, 
"exclusion");
+
+        for (Node exclusionNode : exclusionNodes) {
+          excludedGuiElements.add(exclusionNode.getTextContent());
+        }
+      }
 
-      Document document = XmlHandler.loadXmlFile(path);
-      Node exclusionsNode = XmlHandler.getSubNode(document, "exclusions");
-      List<Node> exclusionNodes = XmlHandler.getNodes(exclusionsNode, 
"exclusion");
+      if (configFolderFile.exists()) {
+        path = configFolderFile.getPath().toAbsolutePath().toString();
+        Document document = XmlHandler.loadXmlFile(path);
+        Node exclusionsNode = XmlHandler.getSubNode(document, "exclusions");
+        List<Node> exclusionNodes = XmlHandler.getNodes(exclusionsNode, 
"exclusion");
 
-      for (Node exclusionNode : exclusionNodes) {
-        excludedGuiElements.add(exclusionNode.getTextContent());
+        for (Node exclusionNode : exclusionNodes) {
+          excludedGuiElements.add(exclusionNode.getTextContent());
+        }
       }
-    } catch (HopXmlException e) {
+    } catch (HopXmlException | FileSystemException | HopFileException e) {
       // ignore
     }
 
diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/HopGuiEnvironment.java 
b/ui/src/main/java/org/apache/hop/ui/hopgui/HopGuiEnvironment.java
index 041ca86ff0..d9e6887d7f 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/HopGuiEnvironment.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/HopGuiEnvironment.java
@@ -22,6 +22,8 @@ import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.commons.vfs2.FileObject;
+import org.apache.commons.vfs2.FileSystemException;
 import org.apache.hop.core.Const;
 import org.apache.hop.core.HopClientEnvironment;
 import org.apache.hop.core.action.GuiContextAction;
@@ -44,6 +46,7 @@ import org.apache.hop.core.plugins.IPlugin;
 import org.apache.hop.core.plugins.IPluginType;
 import org.apache.hop.core.plugins.PluginRegistry;
 import org.apache.hop.core.search.SearchableAnalyserPluginType;
+import org.apache.hop.core.vfs.HopVfs;
 import org.apache.hop.core.xml.XmlHandler;
 import org.apache.hop.ui.hopgui.file.HopFileTypePluginType;
 import org.apache.hop.ui.hopgui.file.HopFileTypeRegistry;
@@ -85,16 +88,34 @@ public class HopGuiEnvironment extends HopClientEnvironment 
{
 
     // Try loading code exclusions
     try {
-      String path = Const.HOP_CONFIG_FOLDER + File.separator + 
"disabledGuiElements.xml";
+      FileObject applicationFolderFile = 
HopVfs.getFileObject("./disabledGuiElements.xml");
+      FileObject configFolderFile =
+          HopVfs.getFileObject(
+              Const.HOP_CONFIG_FOLDER + File.separator + 
"disabledGuiElements.xml");
+      String path;
+
+      if (applicationFolderFile.exists()) {
+        path = applicationFolderFile.getPath().toAbsolutePath().toString();
+        Document document = XmlHandler.loadXmlFile(path);
+        Node exclusionsNode = XmlHandler.getSubNode(document, "exclusions");
+        List<Node> exclusionNodes = XmlHandler.getNodes(exclusionsNode, 
"exclusion");
+
+        for (Node exclusionNode : exclusionNodes) {
+          excludedGuiElements.add(exclusionNode.getTextContent());
+        }
+      }
 
-      Document document = XmlHandler.loadXmlFile(path);
-      Node exclusionsNode = XmlHandler.getSubNode(document, "exclusions");
-      List<Node> exclusionNodes = XmlHandler.getNodes(exclusionsNode, 
"exclusion");
+      if (configFolderFile.exists()) {
+        path = configFolderFile.getPath().toAbsolutePath().toString();
+        Document document = XmlHandler.loadXmlFile(path);
+        Node exclusionsNode = XmlHandler.getSubNode(document, "exclusions");
+        List<Node> exclusionNodes = XmlHandler.getNodes(exclusionsNode, 
"exclusion");
 
-      for (Node exclusionNode : exclusionNodes) {
-        excludedGuiElements.add(exclusionNode.getTextContent());
+        for (Node exclusionNode : exclusionNodes) {
+          excludedGuiElements.add(exclusionNode.getTextContent());
+        }
       }
-    } catch (HopXmlException e) {
+    } catch (HopXmlException | FileSystemException e) {
       // ignore
     }
 

Reply via email to