diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
index 76c9815..339011d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
@@ -2255,6 +2255,34 @@ public final class ProtobufUtil {
}
/**
+ * A utility used to get permissions for selected namespace.
+ *
+ * It's also called by the shell, in case you want to find references.
+ *
+ * @param protocol the AccessControlService protocol proxy
+ * @param t namespace name
+ * @throws ServiceException
+ */
+ public static List getUserPermissions(
+ AccessControlService.BlockingInterface protocol,
+ byte[] namespace) throws ServiceException {
+ AccessControlProtos.GetUserPermissionsRequest.Builder builder =
+ AccessControlProtos.GetUserPermissionsRequest.newBuilder();
+ if (namespace != null) {
+ builder.setNamespaceName(HBaseZeroCopyByteString.wrap(namespace));
+ }
+ builder.setType(AccessControlProtos.Permission.Type.Namespace);
+ AccessControlProtos.GetUserPermissionsRequest request = builder.build();
+ AccessControlProtos.GetUserPermissionsResponse response =
+ protocol.getUserPermissions(null, request);
+ List perms = new ArrayList();
+ for (AccessControlProtos.UserPermission perm: response.getUserPermissionList()) {
+ perms.add(ProtobufUtil.toUserPermission(perm));
+ }
+ return perms;
+ }
+
+ /**
* Convert a protobuf UserTablePermissions to a
* ListMultimap where key is username.
*
diff --git a/hbase-shell/src/main/ruby/hbase/security.rb b/hbase-shell/src/main/ruby/hbase/security.rb
index fa9c319..322fc98 100644
--- a/hbase-shell/src/main/ruby/hbase/security.rb
+++ b/hbase-shell/src/main/ruby/hbase/security.rb
@@ -168,7 +168,7 @@ module Hbase
raise(ArgumentError, "Can't find a namespace: #{namespace_name}") unless namespace_exists?(namespace_name)
# invoke cp endpoint to perform access controls
perms = org.apache.hadoop.hbase.protobuf.ProtobufUtil.getUserPermissions(
- protocol, table_name.to_java_bytes)
+ protocol, namespace_name.to_java_bytes)
else
raise(ArgumentError, "Can't find table: #{table_name}") unless exists?(table_name)
perms = org.apache.hadoop.hbase.protobuf.ProtobufUtil.getUserPermissions(