Index: hbase-shell/src/main/ruby/hbase/security.rb =================================================================== --- hbase-shell/src/main/ruby/hbase/security.rb (revision 1583516) +++ hbase-shell/src/main/ruby/hbase/security.rb (working copy) @@ -168,7 +168,7 @@ 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( Index: hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java =================================================================== --- hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java (revision 1583516) +++ hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java (working copy) @@ -2179,6 +2179,34 @@ } /** + * 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 namespace name of the namespace + * @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. *