| 1 |
source include/not_embedded.inc; |
| 2 |
|
| 3 |
create role r1; |
| 4 |
create role r2; |
| 5 |
create role r3; |
| 6 |
create user u1; |
| 7 |
|
| 8 |
#CREATE A CHAIN OF ROLES |
| 9 |
grant r2 to r1; |
| 10 |
grant r3 to r2; |
| 11 |
grant r1 to u1; |
| 12 |
|
| 13 |
--sorted_result |
| 14 |
show grants for u1; |
| 15 |
--sorted_result |
| 16 |
show grants for r1; |
| 17 |
|
| 18 |
grant SELECT on *.* to u1; |
| 19 |
grant INSERT on mysql.* to r1; |
| 20 |
grant DELETE on mysql.roles_mapping to r2; |
| 21 |
grant UPDATE on mysql.user to r3; |
| 22 |
|
| 23 |
create function mysql.test_func (s CHAR(20)) |
| 24 |
returns CHAR(50) DETERMINISTIC |
| 25 |
return concat('Test string: ',s); |
| 26 |
|
| 27 |
delimiter |; |
| 28 |
create procedure mysql.test_proc (OUT param1 INT) |
| 29 |
begin |
| 30 |
select COUNT(*) into param1 from mysql.roles_mapping; |
| 31 |
end| |
| 32 |
delimiter ;| |
| 33 |
|
| 34 |
grant execute on function mysql.test_func to r2; |
| 35 |
grant execute on procedure mysql.test_proc to r3; |
| 36 |
|
| 37 |
--error ER_NONEXISTING_PROC_GRANT |
| 38 |
revoke execute on procedure mysql.test_proc from r2; |
| 39 |
|
| 40 |
--sorted_result |
| 41 |
show grants for r1; |
| 42 |
--sorted_result |
| 43 |
show grants for r2; |
| 44 |
--sorted_result |
| 45 |
show grants for r3; |
| 46 |
|
| 47 |
drop function mysql.test_func; |
| 48 |
drop procedure mysql.test_proc; |
| 49 |
|
| 50 |
create function mysql.test_func (s CHAR(20)) |
| 51 |
returns CHAR(50) DETERMINISTIC |
| 52 |
return concat('Test string: ',s); |
| 53 |
|
| 54 |
--sorted_result |
| 55 |
show grants for r2; |
| 56 |
|
| 57 |
--connect (u1,localhost,u1,,) |
| 58 |
|
| 59 |
--error ER_PROCACCESS_DENIED_ERROR |
| 60 |
select mysql.test_func("none"); |
| 61 |
set role r1; |
| 62 |
--error ER_PROCACCESS_DENIED_ERROR |
| 63 |
select mysql.test_func("r1"); |
| 64 |
|
| 65 |
connection default; |
| 66 |
|
| 67 |
drop function mysql.test_func; |
| 68 |
drop role r1, r2, r3; |
| 69 |
drop user u1; |