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/52afefae
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/52afefae
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/52afefae

Branch: refs/heads/ACCUMULO-802
Commit: 52afefae9cf95beb9a9328def71373b33d91f44f
Parents: 4b03883
Author: Sean Hickey <tallirishll...@gmail.com>
Authored: Thu Aug 1 15:15:39 2013 -0400
Committer: Christopher Tubbs <ctubb...@apache.org>
Committed: Thu Oct 31 21:33:16 2013 -0400

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


http://git-wip-us.apache.org/repos/asf/accumulo/blob/52afefae/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);
   }
 }

Reply via email to