diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-10-18 06:55:26 -0700 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-10-18 06:55:26 -0700 |
commit | 8122996a599fcb6dc600f27fddbed47a2579c6b8 (patch) | |
tree | d27476e2a6491b2b7ffa5247df617a14b6bfd4c0 /mysql-test/r | |
parent | 1ac0b920d572ec393a2b482b6fa0686a6708abdd (diff) | |
download | mariadb-git-8122996a599fcb6dc600f27fddbed47a2579c6b8.tar.gz |
CURRENT_ROLE() function
Diffstat (limited to 'mysql-test/r')
9 files changed, 123 insertions, 3 deletions
diff --git a/mysql-test/r/acl_roles_set_role-database-recursive.result b/mysql-test/r/acl_roles_set_role-database-recursive.result index cbfb50cdf5a..f6d3418f9b6 100644 --- a/mysql-test/r/acl_roles_set_role-database-recursive.result +++ b/mysql-test/r/acl_roles_set_role-database-recursive.result @@ -31,16 +31,28 @@ grant select on mysql.* to test_role2@''; flush privileges; select * from mysql.roles_mapping; ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 select * from mysql.roles_mapping; HostFk UserFk RoleFk test_role1 test_role2 localhost test_user test_role1 localhost test_user test_role2 set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE select * from mysql.roles_mapping; ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' set role test_role2; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role2 select * from mysql.roles_mapping; HostFk UserFk RoleFk test_role1 test_role2 diff --git a/mysql-test/r/acl_roles_set_role-database-simple.result b/mysql-test/r/acl_roles_set_role-database-simple.result index 758bc7340f2..a243b11fc33 100644 --- a/mysql-test/r/acl_roles_set_role-database-simple.result +++ b/mysql-test/r/acl_roles_set_role-database-simple.result @@ -17,7 +17,13 @@ grant insert, delete on mysql.roles_mapping to test_role1@''; grant reload on *.* to test_role1@''; select * from mysql.roles_mapping; ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 select * from mysql.roles_mapping; HostFk UserFk RoleFk localhost test_user test_role1 @@ -29,6 +35,9 @@ insert into mysql.roles_mapping (HostFk, UserFk, RoleFk) values ('localhost', delete from mysql.roles_mapping where RoleFk='test_role2'; use mysql; set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE use mysql; ERROR 42000: Access denied for user 'test_user'@'localhost' to database 'mysql' select * from mysql.roles_mapping; diff --git a/mysql-test/r/acl_roles_set_role-multiple-role.result b/mysql-test/r/acl_roles_set_role-multiple-role.result index e795ecbf27b..0aa105ec0d4 100644 --- a/mysql-test/r/acl_roles_set_role-multiple-role.result +++ b/mysql-test/r/acl_roles_set_role-multiple-role.result @@ -69,7 +69,13 @@ GRANT r_ins TO 'test_user'@'localhost' GRANT r_rld TO 'test_user'@'localhost' GRANT r_sel TO 'test_user'@'localhost' GRANT r_upd TO 'test_user'@'localhost' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE set role r_sel; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_sel show grants; Grants for test_user@localhost GRANT SELECT ON *.* TO 'r_sel' @@ -91,6 +97,9 @@ localhost test_user r_rld localhost test_user r_sel localhost test_user r_upd set role r_ins; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_ins show grants; Grants for test_user@localhost GRANT INSERT ON *.* TO 'r_ins' @@ -110,13 +119,25 @@ insert into mysql.roles_mapping (HostFk, UserFk, RoleFk) values ('', flush privileges; ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation set role r_rld; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_rld flush privileges; set role r_sel; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_sel flush privileges; set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE flush privileges; ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation set role r_ins; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_ins insert into mysql.roles_mapping (HostFk, UserFk, RoleFk) values ('', 'r_sel', 'r_upd'); @@ -133,11 +154,20 @@ insert into mysql.roles_mapping (HostFk, UserFk, RoleFk) values ('', 'r_del', 'r_ins'); set role r_rld; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_rld flush privileges; set role r_sel; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_sel update mysql.roles_mapping set RoleFk='r_ins' where RoleFk='r_ins_wrong'; flush privileges; set role r_sel; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_sel create table mysql.random_test_table (id INT); insert into mysql.random_test_table values (1); select * from mysql.random_test_table; @@ -146,6 +176,9 @@ id delete from mysql.roles_mapping where RoleFk='r_ins'; flush privileges; set role r_sel; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_sel insert into mysql.random_test_table values (1); ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table 'random_test_table' drop table mysql.random_test_table; diff --git a/mysql-test/r/acl_roles_set_role-recursive.result b/mysql-test/r/acl_roles_set_role-recursive.result index 8971cd1bf8a..505e1f5f730 100644 --- a/mysql-test/r/acl_roles_set_role-recursive.result +++ b/mysql-test/r/acl_roles_set_role-recursive.result @@ -35,7 +35,13 @@ show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO 'test_user'@'localhost' GRANT test_role1 TO 'test_user'@'localhost' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 show grants; Grants for test_user@localhost GRANT SELECT ON *.* TO 'test_role2' @@ -54,6 +60,9 @@ GRANT USAGE ON *.* TO 'test_user'@'localhost' GRANT test_role1 TO 'test_user'@'localhost' GRANT test_role2 TO 'test_role1' set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO 'test_user'@'localhost' @@ -66,6 +75,9 @@ GRANT USAGE ON *.* TO 'test_user'@'localhost' GRANT test_role1 TO 'test_user'@'localhost' set role test_role2; ERROR HY000: The role 'test_role2' has not been granted or is invalid. +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO 'test_user'@'localhost' @@ -77,6 +89,9 @@ Grants for test_user@localhost GRANT USAGE ON *.* TO 'test_user'@'localhost' GRANT test_role1 TO 'test_user'@'localhost' set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 show grants; Grants for test_user@localhost GRANT SELECT ON *.* TO 'test_role2' @@ -95,6 +110,9 @@ GRANT USAGE ON *.* TO 'test_user'@'localhost' GRANT test_role1 TO 'test_user'@'localhost' GRANT test_role2 TO 'test_role1' set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO 'test_user'@'localhost' diff --git a/mysql-test/r/acl_roles_set_role-routine-simple.result b/mysql-test/r/acl_roles_set_role-routine-simple.result index 5933a3e174d..29f8abb9995 100644 --- a/mysql-test/r/acl_roles_set_role-routine-simple.result +++ b/mysql-test/r/acl_roles_set_role-routine-simple.result @@ -40,7 +40,13 @@ GRANT test_role1 TO 'test_user'@'localhost' GRANT test_role3 TO 'test_user'@'localhost' use mysql; ERROR 42000: Access denied for user 'test_user'@'localhost' to database 'mysql' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 use mysql; call test_proc(@a); SELECT @a; @@ -60,6 +66,9 @@ GRANT test_role1 TO 'test_user'@'localhost' GRANT test_role2 TO 'test_role1' GRANT test_role3 TO 'test_user'@'localhost' set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO 'test_user'@'localhost' @@ -70,6 +79,9 @@ ERROR 42000: execute command denied to user 'test_user'@'localhost' for routine SELECT test_func('AABBCCDD'); ERROR 42000: execute command denied to user 'test_user'@'localhost' for routine 'mysql.test_func' set role test_role3; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role3 show grants; Grants for test_user@localhost GRANT EXECUTE ON `mysql`.* TO 'test_role3' @@ -91,10 +103,7 @@ revoke execute on mysql.* from test_role3@''; delete from mysql.user where user like'test_%'; delete from mysql.roles_mapping where RoleFk like 'test%'; drop function mysql.test_func; -Warnings: -Warning 1403 There is no such grant defined for user 'test_role1' on host '' on routine 'test_func' drop procedure mysql.test_proc; Warnings: Warning 1403 There is no such grant defined for user 'test_role1' on host '' on routine 'test_proc' -Warning 1403 There is no such grant defined for user 'test_role1' on host '' on routine 'test_proc' flush privileges; diff --git a/mysql-test/r/acl_roles_set_role-simple.result b/mysql-test/r/acl_roles_set_role-simple.result index db54592333d..aa68052ae18 100644 --- a/mysql-test/r/acl_roles_set_role-simple.result +++ b/mysql-test/r/acl_roles_set_role-simple.result @@ -22,7 +22,13 @@ show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO 'test_user'@'localhost' GRANT test_role1 TO 'test_user'@'localhost' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 show grants; Grants for test_user@localhost GRANT SELECT ON *.* TO 'test_role1' @@ -32,6 +38,9 @@ select * from mysql.roles_mapping; HostFk UserFk RoleFk localhost test_user test_role1 set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE select * from mysql.roles_mapping; ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' delete from mysql.user where user='test_role1'; diff --git a/mysql-test/r/acl_roles_set_role-table-column-priv.result b/mysql-test/r/acl_roles_set_role-table-column-priv.result index 651a57be36a..bbb964b5d20 100644 --- a/mysql-test/r/acl_roles_set_role-table-column-priv.result +++ b/mysql-test/r/acl_roles_set_role-table-column-priv.result @@ -24,7 +24,13 @@ show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO 'test_user'@'localhost' GRANT test_role1 TO 'test_user'@'localhost' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 show grants; Grants for test_user@localhost GRANT SELECT (RoleFk) ON `mysql`.`roles_mapping` TO 'test_role2' @@ -49,6 +55,9 @@ GRANT test_role1 TO 'test_user'@'localhost' GRANT test_role2 TO 'test_role1' use mysql; set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE select RoleFk from mysql.roles_mapping; ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' drop user 'test_user'@'localhost'; diff --git a/mysql-test/r/acl_roles_set_role-table-simple.result b/mysql-test/r/acl_roles_set_role-table-simple.result index a009ce75515..02730a61e3e 100644 --- a/mysql-test/r/acl_roles_set_role-table-simple.result +++ b/mysql-test/r/acl_roles_set_role-table-simple.result @@ -24,7 +24,13 @@ show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO 'test_user'@'localhost' GRANT test_role1 TO 'test_user'@'localhost' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 show grants; Grants for test_user@localhost GRANT SELECT ON `mysql`.`roles_mapping` TO 'test_role2' @@ -47,6 +53,9 @@ GRANT test_role1 TO 'test_user'@'localhost' GRANT test_role2 TO 'test_role1' use mysql; set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE select * from mysql.roles_mapping; ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' drop user 'test_user'@'localhost'; diff --git a/mysql-test/r/acl_roles_show_grants.result b/mysql-test/r/acl_roles_show_grants.result index 641964bdcee..a28330379b5 100644 --- a/mysql-test/r/acl_roles_show_grants.result +++ b/mysql-test/r/acl_roles_show_grants.result @@ -34,7 +34,13 @@ Grants for test_user@localhost GRANT USAGE ON *.* TO 'test_user'@'localhost' GRANT test_role1 TO 'test_user'@'localhost' GRANT test_role2 TO 'test_user'@'localhost' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 show grants; Grants for test_user@localhost GRANT SELECT ON `mysql`.* TO 'test_role2' @@ -45,6 +51,9 @@ GRANT test_role1 TO 'test_user'@'localhost' GRANT test_role2 TO 'test_role1' GRANT test_role2 TO 'test_user'@'localhost' set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NONE show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO 'test_user'@'localhost' @@ -71,6 +80,9 @@ ERROR 42000: There is no such grant defined for user 'test_user' on host 'localh show grants for CURRENT_ROLE(); ERROR 42000: There is no such grant defined for user 'test_user' on host 'localhost' set role test_role2; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role2 show grants; Grants for test_user@localhost GRANT SELECT ON `mysql`.* TO 'test_role2' |