@@ -52,6 +52,34 @@ def teardown
5252 assert_equal ( 0 , security_admin . user_permission ( @test_name ) . length )
5353 end
5454
55+ define_test "Revoke namespace should rid access rights appropriately" do
56+ ns = 'test_ns_grant_revoke'
57+ command ( :drop_namespace , ns )
58+ command ( :create_namespace , ns )
59+ test_ns_grant_revoke_user = org . apache . hadoop . hbase . security . User . createUserForTesting (
60+ $TEST_CLUSTER. getConfiguration , "test_ns_grant_revoke" , [ ] ) . getName ( )
61+ security_admin . grant ( test_grant_revoke_user , "WRC" , ns )
62+ security_admin . user_permission ( ns ) do |user , permission |
63+ assert_match ( eval ( "/WRITE/" ) , permission . to_s )
64+ assert_match ( eval ( "/READ/" ) , permission . to_s )
65+ assert_match ( eval ( "/CREATE/" ) , permission . to_s )
66+ end
67+
68+ security_admin . revoke ( test_grant_revoke_user , ns , "C" )
69+ found_permission = false
70+ security_admin . user_permission ( ns ) do |user , permission |
71+ if user == "test_ns_grant_revoke"
72+ assert_match ( eval ( "/READ/" ) , permission . to_s )
73+ assert_match ( eval ( "/WRITE/" ) , permission . to_s )
74+ assert_no_match ( eval ( "/EXEC/" ) , permission . to_s )
75+ assert_no_match ( eval ( "/CREATE/" ) , permission . to_s )
76+ assert_no_match ( eval ( "/ADMIN/" ) , permission . to_s )
77+ found_permission = true
78+ end
79+ end
80+ assert ( found_permission , "Permission for user test_ns_grant_revoke was not found." )
81+ end
82+
5583 define_test "Grant should set access rights appropriately" do
5684 drop_test_table ( @test_name )
5785 create_test_table ( @test_name )
0 commit comments