Return-Path: X-Original-To: apmail-sentry-commits-archive@minotaur.apache.org Delivered-To: apmail-sentry-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1828A117A0 for ; Tue, 16 Sep 2014 00:29:35 +0000 (UTC) Received: (qmail 23049 invoked by uid 500); 16 Sep 2014 00:29:34 -0000 Delivered-To: apmail-sentry-commits-archive@sentry.apache.org Received: (qmail 23000 invoked by uid 500); 16 Sep 2014 00:29:34 -0000 Mailing-List: contact commits-help@sentry.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sentry.incubator.apache.org Delivered-To: mailing list commits@sentry.incubator.apache.org Received: (qmail 22991 invoked by uid 99); 16 Sep 2014 00:29:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Sep 2014 00:29:34 +0000 X-ASF-Spam-Status: No, hits=-2000.7 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 16 Sep 2014 00:29:33 +0000 Received: (qmail 22893 invoked by uid 99); 16 Sep 2014 00:29:13 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Sep 2014 00:29:13 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id AF290A14B89; Tue, 16 Sep 2014 00:29:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sravya@apache.org To: commits@sentry.incubator.apache.org Message-Id: <4a62d20ab32f4406a1cb97fbf58ebee1@git.apache.org> X-Mailer: ASF-Git Admin Mailer 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 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org 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 Authored: Mon Sep 15 17:27:37 2014 -0700 Committer: Sravya Tirukkovalur 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 uriHierarchy = new ArrayList(); 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 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,