ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject incubator-ranger git commit: RANGER-605: ScriptEvaluator should return true if no script specified
Date Fri, 21 Aug 2015 08:27:59 GMT
Repository: incubator-ranger
Updated Branches:
  refs/heads/tag-policy 8c76e1436 -> 2e4b430fd


RANGER-605: ScriptEvaluator should return true if no script specified

Signed-off-by: Madhan Neethiraj <madhan@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/2e4b430f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/2e4b430f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/2e4b430f

Branch: refs/heads/tag-policy
Commit: 2e4b430fd6b408b92b18e31fdaf29e2f902c8028
Parents: 8c76e14
Author: Abhay Kulkarni <akulkarni@hortonworks.com>
Authored: Thu Aug 20 11:11:03 2015 -0700
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Fri Aug 21 01:22:08 2015 -0700

----------------------------------------------------------------------
 .../RangerScriptConditionEvaluator.java            |  2 +-
 .../RangerScriptTemplateConditionEvaluator.java    | 17 +----------------
 2 files changed, 2 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2e4b430f/agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptConditionEvaluator.java
----------------------------------------------------------------------
diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptConditionEvaluator.java
b/agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptConditionEvaluator.java
index 41fa3d3..48ffc38 100644
--- a/agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptConditionEvaluator.java
+++ b/agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptConditionEvaluator.java
@@ -80,7 +80,7 @@ public class RangerScriptConditionEvaluator extends RangerAbstractConditionEvalu
 		if (LOG.isDebugEnabled()) {
 			LOG.debug("==> RangerScriptConditionEvaluator.isMatched()");
 		}
-		boolean result = false;
+		boolean result = true;
 
 		if (scriptEngine != null) {
 

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2e4b430f/agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptTemplateConditionEvaluator.java
----------------------------------------------------------------------
diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptTemplateConditionEvaluator.java
b/agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptTemplateConditionEvaluator.java
index 44157c3..a4fd129 100644
--- a/agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptTemplateConditionEvaluator.java
+++ b/agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptTemplateConditionEvaluator.java
@@ -51,10 +51,6 @@ public class RangerScriptTemplateConditionEvaluator extends RangerScriptConditio
 			scriptTemplate = evalOptions.get("scriptTemplate");
 		}
 
-		if (StringUtils.isNotBlank(scriptTemplate)) {
-			scriptTemplate = scriptTemplate.trim();
-		}
-
 		script = formatScript();
 
 		if (LOG.isDebugEnabled()) {
@@ -67,17 +63,6 @@ public class RangerScriptTemplateConditionEvaluator extends RangerScriptConditio
 		return script;
 	}
 
-	@Override
-	public boolean isMatched(RangerAccessRequest request) {
-		boolean ret = true;
-
-		if (StringUtils.isNotBlank(script)) {
-			ret = super.isMatched(request);
-		}
-
-		return ret;
-	}
-
 	private String formatScript() {
 
 		String ret = null;
@@ -98,7 +83,7 @@ public class RangerScriptTemplateConditionEvaluator extends RangerScriptConditio
 				if (s.equals("no") || s.equals("false")) {
 					ret = null;
 				} else {
-					ret = scriptTemplate;
+					ret = scriptTemplate == null ? null : scriptTemplate.trim();
 				}
 			}
 		}


Mime
View raw message