HBASE-7658 grant with an empty string as permission should throw an exception

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1466600 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
mbertozzi 2013-04-10 18:03:24 +00:00
parent cc8e0d3341
commit 511663e059
4 changed files with 11 additions and 4 deletions

View File

@ -142,8 +142,9 @@ public class AccessControlLists {
byte[] key = userPermissionKey(userPerm);
if ((actions == null) || (actions.length == 0)) {
LOG.warn("No actions associated with user '"+Bytes.toString(userPerm.getUser())+"'");
return;
String msg = "No actions associated with user '" + Bytes.toString(userPerm.getUser()) + "'";
LOG.warn(msg);
throw new IOException(msg);
}
byte[] value = new byte[actions.length];

View File

@ -36,6 +36,11 @@ module Hbase
# TODO: need to validate user name
# Verify that the specified permission is valid
if (permissions == nil || permissions.length == 0)
raise(ArgumentError, "Ivalid permission: no actions associated with user")
end
if (table_name != nil)
# Table should exist
raise(ArgumentError, "Can't find a table: #{table_name}") unless exists?(table_name)

View File

@ -22,7 +22,7 @@ module Shell
def help
return <<-EOF
Grant users specific rights.
Syntax : grant <user> <permissions> <table> <column family> <column qualifier>
Syntax : grant <user> <permissions> [<table> [<column family> [<column qualifier>]]
permissions is either zero or more letters from the set "RWXCA".
READ('R'), WRITE('W'), EXEC('X'), CREATE('C'), ADMIN('A')

View File

@ -22,9 +22,10 @@ module Shell
def help
return <<-EOF
Revoke a user's access rights.
Syntax : revoke <user> <table> <column family> <column qualifier>
Syntax : revoke <user> [<table> [<column family> [<column qualifier>]]
For example:
hbase> revoke 'bobsmith'
hbase> revoke 'bobsmith', 't1', 'f1', 'col1'
EOF
end