mariadb/mysql-test/t/acl_roles_admin.test

73 lines
1.7 KiB
Text
Raw Normal View History

create user foo@localhost;
########################################
# syntax tests
########################################
create role role1;
create role role2 with admin current_user;
--error ER_MALFORMED_DEFINER
create role role3 with admin current_role;
create role role3 with admin role1;
create role role4 with admin root@localhost;
create role role5 with admin foo@localhost;
--error ER_NO_SUCH_USER
create role role6 with admin foo@bar;
create user foo@bar;
create role role6 with admin foo@bar;
--error ER_PARSE_ERROR
create user bar with admin current_user;
grant role1 to foo@localhost with admin option;
grant role2 to foo@localhost;
grant role2 to role1;
grant role3 to role4 with admin option;
--error ER_PARSE_ERROR
grant select on *.* to foo@localhost with admin option;
--sorted_result
show grants for foo@localhost;
--sorted_result
show grants for role1;
--sorted_result
show grants for role4;
--sorted_result
select * from mysql.roles_mapping;
flush privileges;
--sorted_result
show grants for foo@localhost;
--sorted_result
show grants for role1;
--sorted_result
show grants for role4;
grant role2 to role1 with admin option;
revoke role1 from foo@localhost;
revoke admin option for role3 from role4;
revoke admin option for role2 from foo@localhost;
--sorted_result
show grants for foo@localhost;
--sorted_result
show grants for role1;
--sorted_result
show grants for role4;
--sorted_result
select * from mysql.roles_mapping;
flush privileges;
--sorted_result
show grants for foo@localhost;
--sorted_result
show grants for role1;
--sorted_result
show grants for role4;
########################################
# cleanup
########################################
drop role role1, role2, role3, role4, role5, role6;
drop user foo@localhost, foo@bar;