2013-10-19 03:56:28 +02:00
|
|
|
source include/not_embedded.inc;
|
|
|
|
|
2013-10-18 21:21:10 +02:00
|
|
|
create user test_user@localhost;
|
2013-10-18 15:47:49 +02:00
|
|
|
create role test_role1;
|
|
|
|
create role test_role2;
|
|
|
|
|
2013-10-18 21:21:10 +02:00
|
|
|
grant test_role1 to test_user@localhost;
|
2013-10-18 21:34:44 +02:00
|
|
|
grant test_role2 to test_role1;
|
2013-10-18 15:47:49 +02:00
|
|
|
--sorted_result
|
|
|
|
select user, host from mysql.user where user not like 'root';
|
|
|
|
--sorted_result
|
|
|
|
select * from mysql.roles_mapping;
|
|
|
|
|
2013-10-18 18:08:42 +02:00
|
|
|
grant select on mysql.roles_mapping to test_role2;
|
2013-10-18 15:47:49 +02:00
|
|
|
|
|
|
|
change_user 'test_user';
|
|
|
|
|
|
|
|
--error ER_TABLEACCESS_DENIED_ERROR
|
|
|
|
select * from mysql.roles_mapping;
|
|
|
|
|
|
|
|
--sorted_result
|
|
|
|
show grants;
|
|
|
|
|
2013-10-18 15:55:26 +02:00
|
|
|
select current_user(), current_role();
|
2013-10-18 15:47:49 +02:00
|
|
|
set role test_role1;
|
2013-10-18 15:55:26 +02:00
|
|
|
select current_user(), current_role();
|
2013-10-18 15:47:49 +02:00
|
|
|
|
|
|
|
--sorted_result
|
|
|
|
show grants;
|
|
|
|
|
|
|
|
--sorted_result
|
|
|
|
select * from mysql.roles_mapping;
|
|
|
|
|
|
|
|
--sorted_result
|
|
|
|
show grants;
|
|
|
|
|
|
|
|
use mysql;
|
|
|
|
|
|
|
|
set role none;
|
2013-10-18 15:55:26 +02:00
|
|
|
select current_user(), current_role();
|
2013-10-18 15:47:49 +02:00
|
|
|
|
|
|
|
--sorted_result
|
|
|
|
--error ER_TABLEACCESS_DENIED_ERROR
|
|
|
|
select * from mysql.roles_mapping;
|
|
|
|
|
|
|
|
change_user 'root';
|
|
|
|
drop user 'test_user'@'localhost';
|
|
|
|
select * from mysql.tables_priv;
|
2013-10-18 18:08:42 +02:00
|
|
|
revoke select on mysql.roles_mapping from test_role2;
|
2013-10-18 15:47:49 +02:00
|
|
|
delete from mysql.user where user like'test_%';
|
2013-10-18 21:19:37 +02:00
|
|
|
delete from mysql.roles_mapping where Role like 'test%';
|
2013-10-18 15:47:49 +02:00
|
|
|
|
|
|
|
flush privileges;
|