You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2013/12/05 00:58:02 UTC

[10/50] [abbrv] git commit: ACCUMULO-1479 fixed minor problems that caused tests to fail, permissions still not fully implemented

ACCUMULO-1479 fixed minor problems that caused tests to fail, permissions still not fully implemented


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

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: ad9abf462eab4108394e510ee2d614b14a3a501e
Parents: dfdf511
Author: Sean Hickey <ta...@gmail.com>
Authored: Thu Aug 1 15:15:39 2013 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Wed Dec 4 18:46:10 2013 -0500

----------------------------------------------------------------------
 .../accumulo/server/security/SecurityOperation.java      | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/ad9abf46/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java b/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
index cad84d0..6dcaf9d 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
@@ -26,6 +26,7 @@ import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.TableNamespaceNotFoundException;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.admin.SecurityOperationsImpl;
+import org.apache.accumulo.core.client.impl.TableNamespaces;
 import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
 import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
@@ -338,7 +339,12 @@ public class SecurityOperation {
   protected boolean hasTableNamespacePermissionForTableName(TCredentials credentials, String tableName, TableNamespacePermission permission, boolean useCached)
       throws ThriftSecurityException {
     String tableNamespace = Tables.extractNamespace(tableName);
-    return hasTableNamespacePermission(credentials, tableNamespace, permission, useCached);
+    try {
+      String namespace = TableNamespaces.getNamespaceId(HdfsZooInstance.getInstance(), tableNamespace);
+      return hasTableNamespacePermission(credentials, namespace, permission, useCached);
+    } catch (TableNamespaceNotFoundException e) {
+      return false;
+    }
   }
   
   /**
@@ -792,8 +798,7 @@ public class SecurityOperation {
   
   public boolean canImport(TCredentials credentials, String tableName, String importDir) throws ThriftSecurityException {
     authenticate(credentials);
-    String tableId = Tables.getNamespace(HdfsZooInstance.getInstance(), tableName);
     return hasSystemPermission(credentials, SystemPermission.CREATE_TABLE, false)
-        || hasTableNamespacePermissionForTableId(credentials, tableId, TableNamespacePermission.CREATE_TABLE, false);
+        || hasTableNamespacePermissionForTableName(credentials, tableName, TableNamespacePermission.CREATE_TABLE, false);
   }
 }