This is an automated email from the ASF dual-hosted git repository.

nikhil 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 7fe2d8e  RANGER-2466 : Addedndum patch Improvement in setting cluster 
Name in RangerAccessRequest
7fe2d8e is described below

commit 7fe2d8e368f71df2c2b0b7c81629402fba6b81bf
Author: Nikhil P <[email protected]>
AuthorDate: Tue Jul 2 18:10:25 2019 +0530

    RANGER-2466 : Addedndum patch Improvement in setting cluster Name in 
RangerAccessRequest
---
 .../ranger/plugin/policyengine/RangerAccessRequestImpl.java |  1 +
 .../org/apache/ranger/plugin/service/RangerBasePlugin.java  | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git 
a/agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessRequestImpl.java
 
b/agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessRequestImpl.java
index 0ccca21..2a28f70 100644
--- 
a/agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessRequestImpl.java
+++ 
b/agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessRequestImpl.java
@@ -73,6 +73,7 @@ public class RangerAccessRequestImpl implements 
RangerAccessRequest {
                setRequestData(null);
                setSessionId(null);
                setContext(null);
+               setClusterName(null);
        }
 
        @Override
diff --git 
a/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java
 
b/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java
index df1fba5..60b4135 100644
--- 
a/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java
+++ 
b/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java
@@ -74,6 +74,7 @@ public class RangerBasePlugin {
        private String                    serviceType;
        private String                    appId;
        private String                    serviceName;
+       private String                    clusterName;
        private PolicyRefresher           refresher;
        private RangerPolicyEngine        policyEngine;
        private RangerPolicyEngineOptions policyEngineOptions = new 
RangerPolicyEngineOptions();
@@ -147,12 +148,20 @@ public class RangerBasePlugin {
                return serviceType;
        }
 
+       public String getClusterName() {
+               return clusterName;
+       }
+
        public RangerAuthContext createRangerAuthContext() {
                return new RangerAuthContext(readOnlyAuthContext);
        }
 
        public RangerAuthContext getCurrentRangerAuthContext() { return 
currentAuthContext; }
 
+       public void setClusterName(String clusterName) {
+               this.clusterName = clusterName;
+       }
+
        public RangerServiceDef getServiceDef() {
                RangerPolicyEngine policyEngine = this.policyEngine;
 
@@ -185,6 +194,10 @@ public class RangerBasePlugin {
                long   pollingIntervalMs = configuration.getLong(propertyPrefix 
+ ".policy.pollIntervalMs", 30 * 1000);
                String cacheDir          = configuration.get(propertyPrefix + 
".policy.cache.dir");
                serviceName = configuration.get(propertyPrefix + 
".service.name");
+               clusterName = 
RangerConfiguration.getInstance().get(propertyPrefix + ".access.cluster.name", 
"");
+               if(StringUtil.isEmpty(clusterName)){
+                       clusterName = 
RangerConfiguration.getInstance().get(propertyPrefix + ".ambari.cluster.name", 
"");
+               }
                useForwardedIPAddress = configuration.getBoolean(propertyPrefix 
+ ".use.x-forwarded-for.ipaddress", false);
                String trustedProxyAddressString = 
configuration.get(propertyPrefix + ".trusted.proxy.ipaddresses");
                trustedProxyAddresses = 
StringUtils.split(trustedProxyAddressString, 
RANGER_TRUSTED_PROXY_IPADDRESSES_SEPARATOR_CHAR);

Reply via email to