Commit a0a8f508 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru Committed by Sergei Golubchik

Added a test for acl_roles to test renaming of roles/ usernames

parent 9fa7f1fc
create user 'test_user'@'localhost';
create user 'test_role1'@'';
update mysql.user set is_role='Y' where user='test_role1';
insert into mysql.roles_mapping (HostFk, UserFk, RoleFk) values ('localhost',
'test_user',
'test_role1');
create user 'test_role2'@'';
update mysql.user set is_role='Y' where user='test_role2';
insert into mysql.roles_mapping (HostFk, UserFk, RoleFk) values ('',
'test_role1',
'test_role2');
flush privileges;
use mysql;
select * from roles_mapping;
HostFk UserFk RoleFk
localhost test_user test_role1
test_role1 test_role2
rename user 'test_user'@'localhost' to 'test_user_rm'@'newhost';
select user, host from user where user like 'test%';
user host
test_role1
test_role2
test_user_rm newhost
select * from roles_mapping;
HostFk UserFk RoleFk
newhost test_user_rm test_role1
test_role1 test_role2
rename user 'test_role2'@'' to 'test_role2_rm'@'';
select user, host from user where user like 'test%';
user host
test_role1
test_role2_rm
test_user_rm newhost
select * from roles_mapping;
HostFk UserFk RoleFk
newhost test_user_rm test_role1
test_role1 test_role2_rm
rename user 'test_role1'@'' to 'test_role1_rm'@'';
select user, host from user where user like 'test%';
user host
test_role1_rm
test_role2_rm
test_user_rm newhost
select * from roles_mapping;
HostFk UserFk RoleFk
newhost test_user_rm test_role1_rm
test_role1_rm test_role2_rm
delete from mysql.roles_mapping;
delete from mysql.user where user like 'test%';
flush privileges;
#create a user with no privileges
create user 'test_user'@'localhost';
create user 'test_role1'@'';
#manualy create role
update mysql.user set is_role='Y' where user='test_role1';
insert into mysql.roles_mapping (HostFk, UserFk, RoleFk) values ('localhost',
'test_user',
'test_role1');
create user 'test_role2'@'';
#manualy create role
update mysql.user set is_role='Y' where user='test_role2';
insert into mysql.roles_mapping (HostFk, UserFk, RoleFk) values ('',
'test_role1',
'test_role2');
flush privileges;
use mysql;
select * from roles_mapping;
#regular user rename
rename user 'test_user'@'localhost' to 'test_user_rm'@'newhost';
select user, host from user where user like 'test%';
select * from roles_mapping;
rename user 'test_role2'@'' to 'test_role2_rm'@'';
select user, host from user where user like 'test%';
select * from roles_mapping;
#role rename
rename user 'test_role1'@'' to 'test_role1_rm'@'';
select user, host from user where user like 'test%';
select * from roles_mapping;
delete from mysql.roles_mapping;
delete from mysql.user where user like 'test%';
flush privileges;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment