From 281285761fdae2ad194a355216bda484391acc98 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Tue, 29 Oct 2024 14:38:58 +0100 Subject: [PATCH] fixed var name --- .../environments/HierarchicalSystemEnvironment.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/environments/HierarchicalSystemEnvironment.java b/src/main/java/org/gcube/informationsystem/resourceregistry/environments/HierarchicalSystemEnvironment.java index 0fad5f0..feb23f4 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/environments/HierarchicalSystemEnvironment.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/environments/HierarchicalSystemEnvironment.java @@ -62,13 +62,17 @@ public abstract class HierarchicalSystemEnvironment extends SystemEnvironment { this.hierarchicPoolMap = new HashMap<>(); + boolean hierarchicalModeRequested = RequestUtility.getRequestInfo().get().isHierarchicalMode(); + logger.trace("HierarchicalMode {}requested", hierarchicalModeRequested ? "" : "not "); + boolean hierarchicalAllowed = isUserAllowed(SystemEnvironment.getAllOperationsAllowedRoles()); + logger.trace("{} is {}to request the ", ContextUtility.getCurrentUserUsername(), hierarchicalAllowed ? "" : "not "); /* * Only the Infrastructure Manager and IS Manager are entitled to use hierarchical mode. * I decided not to complain if the user does not have such roles and assumed the hierarchical mode was not requested. */ - if(!hierarchicalAllowed) { + if(hierarchicalModeRequested && !hierarchicalAllowed) { StringBuffer sb = new StringBuffer(); sb.append("The user "); sb.append(ContextUtility.getCurrentUserUsername()); @@ -77,14 +81,15 @@ public abstract class HierarchicalSystemEnvironment extends SystemEnvironment { sb.append(". Instead of complaining, the request will be elaborated not in hierarchical mode."); logger.warn(sb.toString()); } - this.hierarchical = hierarchicalAllowed; + + this.hierarchical = hierarchicalAllowed && hierarchicalModeRequested; this.children = new HashSet<>(); } protected boolean isHierarchicalMode() { - return hierarchical || RequestUtility.getRequestInfo().get().isHierarchicalMode(); + return hierarchical; } public void setParentEnvironment(HierarchicalSystemEnvironment parentEnvironment) {