This is an automated email from the ASF dual-hosted git repository. madhan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/ranger.git
The following commit(s) were added to refs/heads/master by this push: new 7a7a78720 RANGER-4286: allow security-zone to exist without any services/resources assigned - #2 7a7a78720 is described below commit 7a7a78720284b29acb2757f3949b751c1bc8eceb Author: Madhan Neethiraj <mad...@apache.org> AuthorDate: Thu Jun 22 17:39:57 2023 -0700 RANGER-4286: allow security-zone to exist without any services/resources assigned - #2 --- .../apache/ranger/plugin/store/SecurityZonePredicateUtil.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/store/SecurityZonePredicateUtil.java b/agents-common/src/main/java/org/apache/ranger/plugin/store/SecurityZonePredicateUtil.java index df5fc7956..9164091ae 100644 --- a/agents-common/src/main/java/org/apache/ranger/plugin/store/SecurityZonePredicateUtil.java +++ b/agents-common/src/main/java/org/apache/ranger/plugin/store/SecurityZonePredicateUtil.java @@ -27,7 +27,6 @@ import org.apache.ranger.plugin.util.SearchFilter; import java.util.List; public class SecurityZonePredicateUtil extends AbstractPredicateUtil { - public SecurityZonePredicateUtil() { super(); } @@ -107,6 +106,9 @@ public class SecurityZonePredicateUtil extends AbstractPredicateUtil { } private Predicate addPredicateForMatchingZoneName(final String zoneName, List<Predicate> predicates) { + if (StringUtils.isEmpty(zoneName)) { + return null; + } Predicate ret = new Predicate() { @Override @@ -137,6 +139,9 @@ public class SecurityZonePredicateUtil extends AbstractPredicateUtil { } private Predicate addPredicateForNonMatchingZoneName(final String zoneName, List<Predicate> predicates) { + if (StringUtils.isEmpty(zoneName)) { + return null; + } Predicate ret = new Predicate() { @Override @@ -150,7 +155,7 @@ public class SecurityZonePredicateUtil extends AbstractPredicateUtil { if(object instanceof RangerSecurityZone) { RangerSecurityZone securityZone = (RangerSecurityZone) object; - if (StringUtils.isEmpty(zoneName) || !StringUtils.equals(zoneName, securityZone.getName())) { + if (!StringUtils.equals(zoneName, securityZone.getName())) { ret = true; } }