Repository: ranger Updated Branches: refs/heads/master 13a1e7f71 -> 3d59099dc
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/3d59099d Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/3d59099d Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/3d59099d Branch: refs/heads/master Commit: 3d59099dcff757d420748793d6d9abe904a59165 Parents: 13a1e7f Author: zhangqiang2 <[email protected]> Authored: Mon Oct 8 10:06:32 2018 +0800 Committer: peng.jianhua <[email protected]> Committed: Fri Oct 12 13:43:33 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/3d59099d/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()) {
