sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sra...@apache.org
Subject git commit: SENTRY-421: Metastore binding is not constructing in fully qualified URI sentry recognizable format (Prasad Mujumdar via Sravya Tirukkovalur)
Date Tue, 16 Sep 2014 00:29:12 GMT
Repository: incubator-sentry
Updated Branches:
  refs/heads/master 00a5eba1f -> 89a9243fd


SENTRY-421: Metastore binding is not constructing in fully qualified URI sentry recognizable
format (Prasad Mujumdar via Sravya Tirukkovalur)


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

Branch: refs/heads/master
Commit: 89a9243fd3a11f0852c303533b92013633cd6c23
Parents: 00a5eba
Author: Sravya Tirukkovalur <sravya@clouera.com>
Authored: Mon Sep 15 17:27:37 2014 -0700
Committer: Sravya Tirukkovalur <sravya@clouera.com>
Committed: Mon Sep 15 17:27:37 2014 -0700

----------------------------------------------------------------------
 .../metastore/MetastoreAuthzBinding.java        | 21 +++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/89a9243f/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/MetastoreAuthzBinding.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/MetastoreAuthzBinding.java
b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/MetastoreAuthzBinding.java
index 51e3d77..e7f96c1 100644
--- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/MetastoreAuthzBinding.java
+++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/MetastoreAuthzBinding.java
@@ -100,11 +100,17 @@ public class MetastoreAuthzBinding extends MetaStorePreEventListener
{
       return this;
     }
 
-    public HierarcyBuilder addUriToOutput(Server server, String uriPath) {
+    public HierarcyBuilder addUriToOutput(Server server, String uriPath,
+        String warehouseDirPath) throws MetaException {
       List<DBModelAuthorizable> uriHierarchy = new ArrayList<DBModelAuthorizable>();
       addServerToOutput(server);
       uriHierarchy.add(server);
-      uriHierarchy.add(new AccessURI(uriPath));
+      try {
+        uriHierarchy.add(new AccessURI(PathUtils.parseDFSURI(warehouseDirPath,
+            uriPath)));
+      } catch (URISyntaxException e) {
+        throw new MetaException("Error paring the URI " + e.getMessage());
+      }
       authHierarchy.add(uriHierarchy);
       return this;
     }
@@ -130,7 +136,7 @@ public class MetastoreAuthzBinding extends MetaStorePreEventListener {
   private final HiveConf hiveConf;
   private final ImmutableSet<String> serviceUsers;
   private HiveAuthzBinding hiveAuthzBinding;
-  private String warehouseDir;
+  private final String warehouseDir;
 
   public MetastoreAuthzBinding(Configuration config) throws Exception {
     super(config);
@@ -233,7 +239,7 @@ public class MetastoreAuthzBinding extends MetaStorePreEventListener {
       } catch(URISyntaxException e) {
         throw new MetaException(e.getMessage());
       }
-      inputBuilder.addUriToOutput(getAuthServer(), uriPath);
+      inputBuilder.addUriToOutput(getAuthServer(), uriPath, warehouseDir);
     }
     authorizeMetastoreAccess(HiveOperation.CREATETABLE, inputBuilder.build(),
         outputBuilder.build());
@@ -280,7 +286,8 @@ public class MetastoreAuthzBinding extends MetaStorePreEventListener {
       throw new MetaException(e.getMessage());
     }
     if (oldLocationUri.compareTo(newLocationUri) != 0) {
-      outputBuilder.addUriToOutput(getAuthServer(), newLocationUri);
+      outputBuilder.addUriToOutput(getAuthServer(), newLocationUri,
+          warehouseDir);
       operation = HiveOperation.ALTERTABLE_LOCATION;
     }
     authorizeMetastoreAccess(
@@ -314,7 +321,7 @@ public class MetastoreAuthzBinding extends MetaStorePreEventListener {
 	        throw new MetaException(e.getMessage());
 	      }
 	      if (!partitionLocation.startsWith(tableLocation + File.separator)) {
-	        outputBuilder.addUriToOutput(getAuthServer(), uriPath);
+          outputBuilder.addUriToOutput(getAuthServer(), uriPath, warehouseDir);
 	      }
 	    }
       authorizeMetastoreAccess(HiveOperation.ALTERTABLE_ADDPARTS,
@@ -356,7 +363,7 @@ public class MetastoreAuthzBinding extends MetaStorePreEventListener {
       } catch (URISyntaxException e) {
         throw new MetaException(e.getMessage());
       }
-      outputBuilder.addUriToOutput(getAuthServer(), uriPath);
+      outputBuilder.addUriToOutput(getAuthServer(), uriPath, warehouseDir);
     }
     authorizeMetastoreAccess(
         HiveOperation.ALTERPARTITION_LOCATION,


Mime
View raw message