| 1 |
source include/not_embedded.inc; |
| 2 |
|
| 3 |
--echo # |
| 4 |
--echo # MDEV-13655: SET ROLE does not properly grant privileges. |
| 5 |
--echo # |
| 6 |
--echo # We must test that if aditional db privileges get granted to a role |
| 7 |
--echo # which previously inherited privileges from another granted role |
| 8 |
--echo # keep the internal memory structures intact. |
| 9 |
--echo # |
| 10 |
|
| 11 |
create role simple; |
| 12 |
|
| 13 |
--echo # |
| 14 |
--echo # First we create an entry with privileges for databases for the simple role. |
| 15 |
--echo # |
| 16 |
grant select, insert, update, delete, lock tables, execute on t.* to simple; |
| 17 |
create role admin; |
| 18 |
|
| 19 |
--echo # |
| 20 |
--echo # Now we grant the simple role to admin. This means that db privileges |
| 21 |
--echo # should propagate to admin. |
| 22 |
--echo # |
| 23 |
grant simple to admin; |
| 24 |
show grants for admin; |
| 25 |
|
| 26 |
--echo # |
| 27 |
--echo # Finally, we give the admin all the available privileges for the db. |
| 28 |
--echo # |
| 29 |
grant all on t.* to admin; |
| 30 |
|
| 31 |
--echo # |
| 32 |
--echo # Create a user to test out the new roles; |
| 33 |
--echo # |
| 34 |
create user foo; |
| 35 |
grant admin to foo; |
| 36 |
|
| 37 |
connect (foo,localhost,foo,,,,,); |
| 38 |
--error ER_DBACCESS_DENIED_ERROR |
| 39 |
create database t; |
| 40 |
set role admin; |
| 41 |
show grants; |
| 42 |
create database t; |
| 43 |
drop database t; |
| 44 |
|
| 45 |
connection default; |
| 46 |
|
| 47 |
drop role simple; |
| 48 |
drop role admin; |
| 49 |
drop user foo; |