Repository: incubator-ranger
Updated Branches:
  refs/heads/master d879a2567 -> 3df4ae5ea


RANGER-830: Unit test for verifying behaviour of "Exclude" setting in the 
Ranger Policy

Signed-off-by: Madhan Neethiraj <[email protected]>


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

Branch: refs/heads/master
Commit: 3df4ae5ea5ebb52587e1a46b69b3fa16bba2dcd2
Parents: d879a25
Author: Abhay Kulkarni <[email protected]>
Authored: Thu Jan 28 14:11:08 2016 -0800
Committer: Madhan Neethiraj <[email protected]>
Committed: Wed Mar 2 10:29:56 2016 -0800

----------------------------------------------------------------------
 .../policyengine/test_policyengine_hive.json    | 23 ++++++++++++++++++++
 1 file changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/3df4ae5e/agents-common/src/test/resources/policyengine/test_policyengine_hive.json
----------------------------------------------------------------------
diff --git 
a/agents-common/src/test/resources/policyengine/test_policyengine_hive.json 
b/agents-common/src/test/resources/policyengine/test_policyengine_hive.json
index 9cf20b9..4151a87 100644
--- a/agents-common/src/test/resources/policyengine/test_policyengine_hive.json
+++ b/agents-common/src/test/resources/policyengine/test_policyengine_hive.json
@@ -45,9 +45,32 @@
        
{"accesses":[{"type":"select","isAllowed":true}],"users":["user1","user2"],"groups":["group1","group2"],"delegateAdmin":false}
      ]
     }
+    ,
+    {"id":4,"name":"db=db1; table=tmp; 
column=tmp*","isEnabled":true,"isAuditEnabled":true,
+      
"resources":{"database":{"values":["db1"]},"table":{"values":["tmp"]},"column":{"values":["tmp*"],
 "isExcludes":true}},
+      "policyItems":[
+        
{"accesses":[{"type":"select","isAllowed":true}],"users":["user1","user2"],"groups":["group1","group2"],"delegateAdmin":false}
+      ]
+    }
   ],
 
   "tests":[
+    {"name":"DENY 'select tmp_1 from db1.tmp ;' for user1",
+      "request":{
+        "resource":{"elements":{"database":"db1", "table":"tmp", 
"column":"tmp_1"}},
+        
"accessType":"select","user":"user1","userGroups":["users"],"requestData":"select
 tmp_1 from db1.tmp for user1"
+      },
+      "result":{"isAudited":false,"isAllowed":false,"policyId":-1}
+    }
+    ,
+    {"name":"ALLOW 'select abc_1 from db1.tmp ;' for user1",
+      "request":{
+        "resource":{"elements":{"database":"db1", "table":"tmp", 
"column":"abc_1"}},
+        
"accessType":"select","user":"user1","userGroups":["users"],"requestData":"select
 abc_1 from db1.tmp for user1"
+      },
+      "result":{"isAudited":true,"isAllowed":true,"policyId":4}
+    }
+  ,
     {"name":"ALLOW 'use default;' for user1",
      "request":{
       "resource":{"elements":{"database":"default"}},

Reply via email to