Repository: incubator-sentry
Updated Branches:
  refs/heads/master bc5c43450 -> 1434d15b0


SENTRY-869: Add a test where we have multiple column level privileges for a 
given role (Sravya Tirukkovalur, Reviewed by: Colin Ma, Anne Yu)

Change-Id: I6d5eaa6d19218dbe295a7af69bbf29cc3af4f833


Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/1434d15b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/1434d15b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/1434d15b

Branch: refs/heads/master
Commit: 1434d15b0d585ec29c09c9245d64349d96edc904
Parents: bc5c434
Author: Sravya Tirukkovalur <sra...@cloudera.com>
Authored: Mon Mar 21 12:34:44 2016 -0700
Committer: Sravya Tirukkovalur <sra...@cloudera.com>
Committed: Mon Mar 21 12:34:44 2016 -0700

----------------------------------------------------------------------
 .../e2e/hive/TestPrivilegesAtColumnScope.java   | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/1434d15b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtColumnScope.java
----------------------------------------------------------------------
diff --git 
a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtColumnScope.java
 
b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtColumnScope.java
index 6c27cf6..e7a31bf 100644
--- 
a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtColumnScope.java
+++ 
b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtColumnScope.java
@@ -492,4 +492,26 @@ public class TestPrivilegesAtColumnScope extends 
AbstractTestWithStaticConfigura
     statement.close();
     connection.close();
   }
+
+  @Test
+  public void testMultipleColsPerRole() throws Exception {
+
+    policyFile
+        .addRolesToGroup(USERGROUP1, "select_tab1_AB")
+        .addPermissionsToRole("select_tab1_AB", 
"server=server1->db=DB_1->table=TAB_1->column=A->action=select")
+        .addPermissionsToRole("select_tab1_AB", 
"server=server1->db=DB_1->table=TAB_1->column=B->action=select")
+        .setUserGroupMapping(StaticUserGroup.getStaticMapping());
+    writePolicyFile(policyFile);
+
+    // test execution on user1
+    Connection connection = context.createConnection(USER1_1);
+    Statement statement = context.createStatement(connection);
+    statement.execute("USE DB_1");
+
+    // test user can execute query count on column A on tab_1
+    statement.executeQuery("SELECT A,B FROM TAB_1");
+
+    statement.close();
+    connection.close();
+  }
 }

Reply via email to