Skip to content

Commit d769ec0

Browse files
committed
HBASE-26208 Supports revoke @ns specified permission
1 parent 5cf728d commit d769ec0

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

hbase-shell/src/main/ruby/hbase/security.rb

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,21 @@ def revoke(user, table_name = nil, family = nil, qualifier = nil)
100100
namespace_name = table_name[1...table_name.length]
101101
raise(ArgumentError, "Can't find a namespace: #{namespace_name}") unless namespace_exists?(namespace_name)
102102

103-
tablebytes = table_name.to_java_bytes
104-
org.apache.hadoop.hbase.security.access.AccessControlClient.revoke(
105-
@connection, namespace_name, user
106-
)
103+
if (!family.nil?)
104+
permission = family[1...family.length-1]
105+
perm = org.apache.hadoop.hbase.security.access.Permission.new(
106+
permission.to_java_bytes
107+
)
108+
puts "revoke #{permission} permission"
109+
org.apache.hadoop.hbase.security.access.AccessControlClient.revoke(
110+
@connection, namespace_name, user, perm.getActions
111+
)
112+
else
113+
tablebytes = table_name.to_java_bytes
114+
org.apache.hadoop.hbase.security.access.AccessControlClient.revoke(
115+
@connection, namespace_name, user
116+
)
117+
end
107118
else
108119
# Table should exist
109120
raise(ArgumentError, "Can't find a table: #{table_name}") unless exists?(table_name)

hbase-shell/src/main/ruby/shell/commands/revoke.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def help
3434
hbase> revoke 'bobsmith'
3535
hbase> revoke '@admins'
3636
hbase> revoke 'bobsmith', '@ns1'
37+
hbase> revoke 'bobsmith', '@ns1', 'RWCA'
3738
hbase> revoke 'bobsmith', 't1', 'f1', 'col1'
3839
hbase> revoke 'bobsmith', 'ns1:t1', 'f1', 'col1'
3940
EOF

0 commit comments

Comments
 (0)