2013-10-18 12:23:15 -07:00
|
|
|
create user foo@localhost;
|
|
|
|
|
|
|
|
########################################
|
|
|
|
# syntax tests
|
|
|
|
########################################
|
|
|
|
|
|
|
|
create role role1;
|
|
|
|
create role role2 with admin current_user;
|
2013-10-18 12:26:05 -07:00
|
|
|
--error ER_MALFORMED_DEFINER
|
2013-10-18 12:23:15 -07:00
|
|
|
create role role3 with admin current_role;
|
2013-10-18 12:26:05 -07:00
|
|
|
create role role3 with admin role1;
|
2013-10-18 12:23:15 -07:00
|
|
|
create role role4 with admin root@localhost;
|
|
|
|
create role role5 with admin foo@localhost;
|
2013-10-18 12:26:05 -07:00
|
|
|
--error ER_NO_SUCH_USER
|
|
|
|
create role role6 with admin foo@bar;
|
|
|
|
|
|
|
|
create user foo@bar;
|
2013-10-18 12:23:15 -07:00
|
|
|
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;
|
2013-10-18 12:25:39 -07:00
|
|
|
grant role2 to foo@localhost;
|
2013-10-18 12:23:15 -07:00
|
|
|
grant role2 to role1;
|
|
|
|
grant role3 to role4 with admin option;
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
grant select on *.* to foo@localhost with admin option;
|
|
|
|
|
2013-10-18 12:25:39 -07:00
|
|
|
--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;
|
2013-10-18 12:25:52 -07:00
|
|
|
flush privileges;
|
|
|
|
--sorted_result
|
|
|
|
show grants for foo@localhost;
|
|
|
|
--sorted_result
|
|
|
|
show grants for role1;
|
|
|
|
--sorted_result
|
|
|
|
show grants for role4;
|
2013-10-18 12:25:39 -07:00
|
|
|
|
|
|
|
grant role2 to role1 with admin option;
|
2013-10-18 12:23:15 -07:00
|
|
|
revoke role1 from foo@localhost;
|
|
|
|
revoke admin option for role3 from role4;
|
2013-10-18 12:25:39 -07:00
|
|
|
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;
|
2013-10-18 12:25:52 -07:00
|
|
|
flush privileges;
|
|
|
|
--sorted_result
|
|
|
|
show grants for foo@localhost;
|
|
|
|
--sorted_result
|
|
|
|
show grants for role1;
|
|
|
|
--sorted_result
|
|
|
|
show grants for role4;
|
2013-10-18 12:23:15 -07:00
|
|
|
|
|
|
|
########################################
|
|
|
|
# cleanup
|
|
|
|
########################################
|
|
|
|
drop role role1, role2, role3, role4, role5, role6;
|
2013-10-18 12:26:05 -07:00
|
|
|
drop user foo@localhost, foo@bar;
|
2013-10-18 12:23:15 -07:00
|
|
|
|