| 1 |
--source include/have_log_bin.inc |
| 2 |
--source include/save_binlog_position.inc |
| 3 |
|
| 4 |
# Save the initial number of concurrent sessions |
| 5 |
--source include/count_sessions.inc |
| 6 |
|
| 7 |
--echo # ---------------------------------------------------------------------- |
| 8 |
|
| 9 |
--echo # Begin : Tests for GRANT ROLE |
| 10 |
|
| 11 |
CREATE USER userX, userY, userZ; |
| 12 |
CREATE ROLE roleX, roleY, roleZ; |
| 13 |
--source include/save_binlog_position.inc |
| 14 |
|
| 15 |
--echo # Case 1 : Execute GRANT ROLE for existing users |
| 16 |
|
| 17 |
GRANT roleX, roleY TO userX, userY; |
| 18 |
|
| 19 |
--echo # Must show grants |
| 20 |
SELECT FROM_USER, TO_USER FROM mysql.role_edges; |
| 21 |
|
| 22 |
--let $event= !Q(GRANT.*roleX.*roleY.*TO.*userX.*userY.*) |
| 23 |
--source ../include/auth_sec_assert_binlog_events.inc |
| 24 |
--source include/save_binlog_position.inc |
| 25 |
|
| 26 |
--echo # Case 2 : Execute GRANT ROLE for non-existing users |
| 27 |
|
| 28 |
--error ER_UNKNOWN_AUTHID |
| 29 |
GRANT roleZ, roleA TO userX, userY; |
| 30 |
|
| 31 |
--error ER_UNKNOWN_AUTHID |
| 32 |
GRANT roleZ TO userX, userA; |
| 33 |
|
| 34 |
--echo # Must not have changed |
| 35 |
SELECT FROM_USER, TO_USER FROM mysql.role_edges; |
| 36 |
|
| 37 |
--let $invert= 1 |
| 38 |
--let $event= !Q(GRANT.*roleZ.*roleA.*TO.*userX.*userY.*) |
| 39 |
--source ../include/auth_sec_assert_binlog_events.inc |
| 40 |
|
| 41 |
--let $event= !Q(GRANT.*roleZ.*TO.*userX.*userA.*) |
| 42 |
--source ../include/auth_sec_assert_binlog_events.inc |
| 43 |
--let $invert= 0 |
| 44 |
|
| 45 |
DROP ROLE roleX, roleY, roleZ; |
| 46 |
DROP USER userX, userY, userZ; |
| 47 |
--source include/save_binlog_position.inc |
| 48 |
|
| 49 |
--echo # End : Tests for GRANT ROLE |
| 50 |
|
| 51 |
--echo # ---------------------------------------------------------------------- |
| 52 |
|
| 53 |
# Wait till we reached the initial number of concurrent sessions |
| 54 |
--source include/wait_until_count_sessions.inc |