Repository: ranger Updated Branches: refs/heads/ranger-1.2 60a496599 -> d21b7b54e
RANGER-2238: String comparison should not use '==' in ServiceUtil.java Signed-off-by: peng.jianhua <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/d21b7b54 Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/d21b7b54 Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/d21b7b54 Branch: refs/heads/ranger-1.2 Commit: d21b7b54e75c5b0155345cc1fbcd181241e36ca0 Parents: 60a4965 Author: zhangqiang2 <[email protected]> Authored: Mon Oct 8 10:06:32 2018 +0800 Committer: peng.jianhua <[email protected]> Committed: Fri Oct 12 13:49:52 2018 +0800 ---------------------------------------------------------------------- .../org/apache/ranger/common/ServiceUtil.java | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ranger/blob/d21b7b54/security-admin/src/main/java/org/apache/ranger/common/ServiceUtil.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/common/ServiceUtil.java b/security-admin/src/main/java/org/apache/ranger/common/ServiceUtil.java index 0292881..c82636a 100644 --- a/security-admin/src/main/java/org/apache/ranger/common/ServiceUtil.java +++ b/security-admin/src/main/java/org/apache/ranger/common/ServiceUtil.java @@ -854,21 +854,21 @@ public class ServiceUtil { int permGroup = 0; for(RangerPolicy.RangerPolicyItem policyItem : policy.getPolicyItems()) { String ipAddress = null; - - for(RangerPolicy.RangerPolicyItemCondition condition : policyItem.getConditions()) { - if(condition.getType() == "ipaddress") { - List<String> values = condition.getValues(); - if (CollectionUtils.isNotEmpty(values)) { - // TODO changes this to properly deal with collection for now just returning 1st item - ipAddress = values.get(0); - } - } - - if(ipAddress != null && !ipAddress.isEmpty()) { - break; // only 1 IP-address per permMap - } - } - + + for (RangerPolicy.RangerPolicyItemCondition condition : policyItem.getConditions()) { + if ("ipaddress".equalsIgnoreCase(condition.getType())) { + List<String> values = condition.getValues(); + if (CollectionUtils.isNotEmpty(values)) { + // TODO changes this to properly deal with collection for now just returning 1st item + ipAddress = values.get(0); + } + } + + if (ipAddress != null && !ipAddress.isEmpty()) { + break; // only 1 IP-address per permMap + } + } + for(String userName : policyItem.getUsers()) { for(RangerPolicyItemAccess access : policyItem.getAccesses()) { if(! access.getIsAllowed()) {
