You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by al...@apache.org on 2015/12/04 19:55:58 UTC

incubator-ranger git commit: RANGER-737 Kafka plugin: add create/delete operation types added as via RANGER-737 to service-def

Repository: incubator-ranger
Updated Branches:
  refs/heads/master 70df061dc -> 591fdceba


RANGER-737 Kafka plugin: add create/delete operation types added as via RANGER-737 to service-def


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

Branch: refs/heads/master
Commit: 591fdceba493d4ad8cf5ac5bb818558763b1a725
Parents: 70df061
Author: Alok Lal <al...@apache.org>
Authored: Fri Dec 4 00:08:32 2015 -0800
Committer: Alok Lal <al...@apache.org>
Committed: Fri Dec 4 10:55:03 2015 -0800

----------------------------------------------------------------------
 .../service-defs/ranger-servicedef-kafka.json        | 15 +++++++++++++--
 .../kafka/authorizer/RangerKafkaAuthorizer.java      |  3 +++
 .../kafka/authorizer/RangerKafkaAuthorizer.java      |  4 ++--
 3 files changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/591fdceb/agents-common/src/main/resources/service-defs/ranger-servicedef-kafka.json
----------------------------------------------------------------------
diff --git a/agents-common/src/main/resources/service-defs/ranger-servicedef-kafka.json b/agents-common/src/main/resources/service-defs/ranger-servicedef-kafka.json
index bf7a4df..839d780 100644
--- a/agents-common/src/main/resources/service-defs/ranger-servicedef-kafka.json
+++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-kafka.json
@@ -61,6 +61,16 @@
 			"label":"Describe"
 		},
 		{
+			"itemId":8,
+			"name":"create",
+			"label":"Create"
+		},
+		{
+			"itemId":9,
+			"name":"delete",
+			"label":"Delete"
+		},
+		{
 			"itemId":7,
 			"name":"kafka_admin",
 			"label":"Kafka Admin",
@@ -68,11 +78,12 @@
 				"publish",
 				"consume",
 				"configure",
-				"describe"
+				"describe",
+				"create",
+				"delete"
 			]
 			
 		}
-		
 	],
 	"configs":[
 		{

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/591fdceb/plugin-kafka/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
----------------------------------------------------------------------
diff --git a/plugin-kafka/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java b/plugin-kafka/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
index 7ca12ce..2adf5d5 100644
--- a/plugin-kafka/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
+++ b/plugin-kafka/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
@@ -125,6 +125,9 @@ public class RangerKafkaAuthorizer implements Authorizer {
 
 		// TODO: If resource type if consumer group, then allow it by default
 		if (resource.resourceType().equals(Group$.MODULE$)) {
+			if (logger.isDebugEnabled()) {
+				logger.debug("If resource type if consumer group, then we allow it by default!  Returning true");
+			}
 			return true;
 		}
 

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/591fdceb/ranger-kafka-plugin-shim/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
----------------------------------------------------------------------
diff --git a/ranger-kafka-plugin-shim/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java b/ranger-kafka-plugin-shim/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
index 90b1ab0..644a223 100644
--- a/ranger-kafka-plugin-shim/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
+++ b/ranger-kafka-plugin-shim/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
@@ -126,7 +126,7 @@ public class RangerKafkaAuthorizer implements Authorizer {
 	@Override
 	public boolean authorize(Session session, Operation operation,Resource resource) {	
 		if(LOG.isDebugEnabled()) {
-			LOG.debug("==> RangerKafkaAuthorizer.authorize(Session, Operation, Resource)");
+			LOG.debug(String.format("==> RangerKafkaAuthorizer.authorize(Session=%s, Operation=%s, Resource=%s)", session, operation, resource));
 		}
 
 		boolean ret = false;
@@ -140,7 +140,7 @@ public class RangerKafkaAuthorizer implements Authorizer {
 		}
 
 		if(LOG.isDebugEnabled()) {
-			LOG.debug("<== RangerKafkaAuthorizer.authorize(Session, Operation, Resource)");
+			LOG.debug("<== RangerKafkaAuthorizer.authorize: " + ret);
 		}
 		
 		return ret;