| 1 |
# |
| 2 |
# Bug #28699403: SHOW GRANTS THROW ERROR FOR EXISTING SESSION WHEN |
| 3 |
# MANDATORY_ROLES CHANGED |
| 4 |
CREATE USER u1@localhost; |
| 5 |
CREATE ROLE r1; |
| 6 |
CREATE TABLE t1 (a INT); |
| 7 |
GRANT ALL ON t1 TO r1; |
| 8 |
SET GLOBAL mandatory_roles="r1"; |
| 9 |
SET GLOBAL activate_all_roles_on_login = 'ON'; |
| 10 |
# in connection con1 |
| 11 |
SHOW GRANTS; |
| 12 |
Grants for u1@localhost |
| 13 |
GRANT USAGE ON *.* TO `u1`@`localhost` |
| 14 |
GRANT ALL PRIVILEGES ON `test`.`t1` TO `u1`@`localhost` |
| 15 |
GRANT `r1`@`%` TO `u1`@`localhost` |
| 16 |
SELECT a FROM t1; |
| 17 |
a |
| 18 |
# in connection default |
| 19 |
SET GLOBAL mandatory_roles=""; |
| 20 |
# in connection con1 |
| 21 |
# test: Must not fail |
| 22 |
SHOW GRANTS; |
| 23 |
Grants for u1@localhost |
| 24 |
GRANT USAGE ON *.* TO `u1`@`localhost` |
| 25 |
SELECT * FROM t1; |
| 26 |
ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table 't1' |
| 27 |
# in connection default |
| 28 |
DROP USER u1@localhost; |
| 29 |
DROP ROLE r1; |
| 30 |
DROP TABLE t1; |
| 31 |
SET GLOBAL mandatory_roles=DEFAULT; |
| 32 |
SET GLOBAL activate_all_roles_on_login=DEFAULT; |
| 33 |
# End of 8.0 tests |