HBASE-9182 Allow non-admin users to list all table names

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1513921 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2013-08-14 15:03:35 +00:00
parent 5d9f9c9a20
commit e79dea8fb4
2 changed files with 6 additions and 2 deletions

View File

@ -2633,7 +2633,7 @@ MasterServices, Server {
}
/**
* Get list of table names
* Get list of userspace table names
* @param controller Unused (set to null).
* @param req GetTableNamesRequest
* @return GetTableNamesResponse
@ -2645,6 +2645,9 @@ MasterServices, Server {
Collection<HTableDescriptor> descriptors = this.tableDescriptors.getAll().values();
GetTableNamesResponse.Builder builder = GetTableNamesResponse.newBuilder();
for (HTableDescriptor descriptor: descriptors) {
if (descriptor.isMetaTable()) {
continue;
}
builder.addTableNames(ProtobufUtil.toProtoTableName(descriptor.getTableName()));
}
return builder.build();

View File

@ -18,6 +18,7 @@
#
include Java
java_import java.util.Arrays
java_import org.apache.hadoop.hbase.util.Pair
java_import org.apache.hadoop.hbase.util.RegionSplitter
java_import org.apache.hadoop.hbase.util.Bytes
@ -42,7 +43,7 @@ module Hbase
#----------------------------------------------------------------------------------------------
# Returns a list of tables in hbase
def list(regex = ".*")
@admin.getTableNames(regex)
Arrays.asList(@admin.getTableNames(regex))
end
#----------------------------------------------------------------------------------------------