From 4713c4e162251d2a12076440df219344bd555898 Mon Sep 17 00:00:00 2001 From: Reid Chan Date: Sat, 17 Nov 2018 13:20:46 +0800 Subject: [PATCH] HBASE-21489 TestShell is broken Signed-off-by Duo Zhang --- hbase-shell/src/main/ruby/hbase/security.rb | 26 ++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/hbase-shell/src/main/ruby/hbase/security.rb b/hbase-shell/src/main/ruby/hbase/security.rb index f16ee6a38b4..52758989ddf 100644 --- a/hbase-shell/src/main/ruby/hbase/security.rb +++ b/hbase-shell/src/main/ruby/hbase/security.rb @@ -142,21 +142,25 @@ module Hbase res = {} count = 0 all_perms.each do |value| - user_name = String.from_java_bytes(value.getUser) + user_name = value.getUser + permission = value.getPermission + table = '' + family = '' + qualifier = '' if !table_regex.nil? && isNamespace?(table_regex) - namespace = value.getNamespace + nsPerm = permission.to_java(org.apache.hadoop.hbase.security.access.NamespacePermission) + namespace = nsPerm.getNamespace else - namespace = !value.getTableName.nil? ? value.getTableName.getNamespaceAsString : value.getNamespace + tblPerm = permission.to_java(org.apache.hadoop.hbase.security.access.TablePermission) + namespace = tblPerm.getNamespace + table = !tblPerm.getTableName.nil? ? tblPerm.getTableName.getNameAsString : '' + family = !tblPerm.getFamily.nil? ? + org.apache.hadoop.hbase.util.Bytes.toStringBinary(tblPerm.getFamily) : '' + qualifier = !tblPerm.getQualifier.nil? ? + org.apache.hadoop.hbase.util.Bytes.toStringBinary(tblPerm.getQualifier) : '' end - table = !value.getTableName.nil? ? value.getTableName.getNameAsString : '' - family = !value.getFamily.nil? ? - org.apache.hadoop.hbase.util.Bytes.toStringBinary(value.getFamily) : - '' - qualifier = !value.getQualifier.nil? ? - org.apache.hadoop.hbase.util.Bytes.toStringBinary(value.getQualifier) : - '' - action = org.apache.hadoop.hbase.security.access.Permission.new value.getActions + action = org.apache.hadoop.hbase.security.access.Permission.new permission.getActions if block_given? yield(user_name, "#{namespace},#{table},#{family},#{qualifier}: #{action}")