sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sp...@apache.org
Subject sentry git commit: SENTRY-2273: Create the SHOW GRANT USER task for Hive (Arjun Mishra, reviewed by Sergio Pena, Na Li)
Date Wed, 27 Jun 2018 18:34:37 GMT
Repository: sentry
Updated Branches:
  refs/heads/master e358fde7f -> 8e64b2fa5


SENTRY-2273: Create the SHOW GRANT USER task for Hive (Arjun Mishra, reviewed by Sergio Pena,
Na Li)


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

Branch: refs/heads/master
Commit: 8e64b2fa5fc84c4683d59097229355329dd06526
Parents: e358fde
Author: Sergio Pena <sergio.pena@cloudera.com>
Authored: Wed Jun 27 13:34:14 2018 -0500
Committer: Sergio Pena <sergio.pena@cloudera.com>
Committed: Wed Jun 27 13:34:14 2018 -0500

----------------------------------------------------------------------
 .../hive/SentryHiveAuthorizationTaskFactoryImpl.java      |  2 +-
 .../hive/TestSentryHiveAuthorizationTaskFactory.java      | 10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/8e64b2fa/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/SentryHiveAuthorizationTaskFactoryImpl.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/SentryHiveAuthorizationTaskFactoryImpl.java
b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/SentryHiveAuthorizationTaskFactoryImpl.java
index e58fe86..2c662e5 100644
--- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/SentryHiveAuthorizationTaskFactoryImpl.java
+++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/SentryHiveAuthorizationTaskFactoryImpl.java
@@ -208,7 +208,7 @@ public class SentryHiveAuthorizationTaskFactoryImpl implements HiveAuthorization
         type = null;
         break;
     }
-    if (type != null && type != PrincipalType.ROLE) {
+    if (type != null && type != PrincipalType.ROLE && type != PrincipalType.USER)
{
       String msg = SentryHiveConstants.SHOW_NOT_SUPPORTED_FOR_PRINCIPAL + type;
       throw new SemanticException(msg);
     }

http://git-wip-us.apache.org/repos/asf/sentry/blob/8e64b2fa/sentry-binding/sentry-binding-hive/src/test/java/org/apache/sentry/binding/hive/TestSentryHiveAuthorizationTaskFactory.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/test/java/org/apache/sentry/binding/hive/TestSentryHiveAuthorizationTaskFactory.java
b/sentry-binding/sentry-binding-hive/src/test/java/org/apache/sentry/binding/hive/TestSentryHiveAuthorizationTaskFactory.java
index e497f8c..b6cf31f 100644
--- a/sentry-binding/sentry-binding-hive/src/test/java/org/apache/sentry/binding/hive/TestSentryHiveAuthorizationTaskFactory.java
+++ b/sentry-binding/sentry-binding-hive/src/test/java/org/apache/sentry/binding/hive/TestSentryHiveAuthorizationTaskFactory.java
@@ -383,8 +383,14 @@ public class TestSentryHiveAuthorizationTaskFactory {
    */
   @Test
   public void testShowGrantUserOnTable() throws Exception {
-    expectSemanticException("SHOW GRANT USER " + USER + " ON TABLE " + TABLE,
-        SentryHiveConstants.SHOW_NOT_SUPPORTED_FOR_PRINCIPAL + "USER");
+    DDLWork work = analyze(parse("SHOW GRANT USER " + USER + " ON TABLE " + TABLE));
+    ShowGrantDesc grantDesc = work.getShowGrantDesc();
+    Assert.assertNotNull("Show grant should not be null", grantDesc);
+    Assert.assertEquals(PrincipalType.USER, grantDesc.getPrincipalDesc().getType());
+    Assert.assertEquals(USER, grantDesc.getPrincipalDesc().getName());
+    Assert.assertTrue("Expected table", grantDesc.getHiveObj().getTable());
+    Assert.assertEquals(TABLE, grantDesc.getHiveObj().getObject());
+    Assert.assertTrue("Expected table", grantDesc.getHiveObj().getTable());
   }
 
   /**


Mime
View raw message