Skip to content

Commit

Permalink
RANGER-4286: allow security-zone to exist without any services/resour…
Browse files Browse the repository at this point in the history
…ces assigned - #2
  • Loading branch information
mneethiraj committed Jun 23, 2023
1 parent fe7f7b0 commit 7a7a787
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.List;

public class SecurityZonePredicateUtil extends AbstractPredicateUtil {

public SecurityZonePredicateUtil() {
super();
}
Expand Down Expand Up @@ -107,6 +106,9 @@ public boolean evaluate(Object object) {
}

private Predicate addPredicateForMatchingZoneName(final String zoneName, List<Predicate> predicates) {
if (StringUtils.isEmpty(zoneName)) {
return null;
}

Predicate ret = new Predicate() {
@Override
Expand Down Expand Up @@ -137,6 +139,9 @@ public boolean evaluate(Object object) {
}

private Predicate addPredicateForNonMatchingZoneName(final String zoneName, List<Predicate> predicates) {
if (StringUtils.isEmpty(zoneName)) {
return null;
}

Predicate ret = new Predicate() {
@Override
Expand All @@ -150,7 +155,7 @@ public boolean evaluate(Object object) {
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;
}
}
Expand Down

0 comments on commit 7a7a787

Please sign in to comment.