Debian Codegraph @

mysql-test/suite/roles/set_role-table-column-priv.result

raw
1 create user test_user@localhost;
2 create role test_role1;
3 create role test_role2;
4 grant test_role1 to test_user@localhost;
5 grant test_role2 to test_role1;
6 select user, host from mysql.user where user not like 'root';
7 User Host
8 mariadb.sys localhost
9 test_role1
10 test_role2
11 test_user localhost
12 select * from mysql.roles_mapping;
13 Host User Role Admin_option
14 test_role1 test_role2 N
15 localhost root test_role1 Y
16 localhost root test_role2 Y
17 localhost test_user test_role1 N
18 grant select (Role) on mysql.roles_mapping to test_role2;
19 select * from mysql.roles_mapping;
20 ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping`
21 show grants;
22 Grants for test_user@localhost
23 GRANT USAGE ON *.* TO `test_user`@`localhost`
24 GRANT `test_role1` TO `test_user`@`localhost`
25 select current_user(), current_role();
26 current_user() current_role()
27 test_user@localhost NULL
28 set role test_role1;
29 select current_user(), current_role();
30 current_user() current_role()
31 test_user@localhost test_role1
32 show grants;
33 Grants for test_user@localhost
34 GRANT SELECT (`Role`) ON `mysql`.`roles_mapping` TO `test_role2`
35 GRANT USAGE ON *.* TO `test_role1`
36 GRANT USAGE ON *.* TO `test_role2`
37 GRANT USAGE ON *.* TO `test_user`@`localhost`
38 GRANT `test_role1` TO `test_user`@`localhost`
39 GRANT `test_role2` TO `test_role1`
40 select * from mysql.roles_mapping;
41 ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for column 'Host' in table 'roles_mapping'
42 select Role from mysql.roles_mapping;
43 Role
44 test_role1
45 test_role1
46 test_role2
47 test_role2
48 show grants;
49 Grants for test_user@localhost
50 GRANT SELECT (`Role`) ON `mysql`.`roles_mapping` TO `test_role2`
51 GRANT USAGE ON *.* TO `test_role1`
52 GRANT USAGE ON *.* TO `test_role2`
53 GRANT USAGE ON *.* TO `test_user`@`localhost`
54 GRANT `test_role1` TO `test_user`@`localhost`
55 GRANT `test_role2` TO `test_role1`
56 use mysql;
57 set role none;
58 select current_user(), current_role();
59 current_user() current_role()
60 test_user@localhost NULL
61 select Role from mysql.roles_mapping;
62 ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping`
63 drop user 'test_user'@'localhost';
64 select * from mysql.tables_priv;
65 Host Db User Table_name Grantor Timestamp Table_priv Column_priv
66 localhost mysql mariadb.sys global_priv root@localhost 0000-00-00 00:00:00 Select,Delete
67 mysql test_role2 roles_mapping root@localhost 0000-00-00 00:00:00 Select
68 revoke select on mysql.roles_mapping from test_role2;
69 delete from mysql.user where user like'test_%';
70 delete from mysql.roles_mapping where Role like 'test%';
71 flush privileges;