Debian Codegraph @

mysql-test/suite/roles/rebuild_role_grants.test

raw
1 source include/not_embedded.inc;
2
3 create role r1;
4 create user u1;
5 grant r1 to u1;
6
7 #CHECK IF GRANTS ARE UPDATED ON GRANT
8 --sorted_result
9 show grants for u1;
10
11 create user u2;
12
13 #CHECK THAT GRANTS ARE UPDATED ON ACL_USERS CHANGE
14 --sorted_result
15 show grants for u1;
16 --sorted_result
17 show grants for u2;
18 --sorted_result
19 select * from mysql.roles_mapping;
20
21 revoke r1 from u1;
22 #TEST ERROR MESSAGE
23 --error ER_CANNOT_REVOKE_ROLE
24 revoke r1 from u1;
25 --sorted_result
26 show grants for u1;
27 --sorted_result
28 select * from mysql.roles_mapping;
29
30 # granting twice is ok
31 grant r1 to u1;
32 grant r1 to u1;
33 --sorted_result
34 show grants for u1;
35 --sorted_result
36 select * from mysql.roles_mapping;
37
38 drop role r1;
39 --sorted_result
40 show grants for u1;
41 --sorted_result
42 select * from mysql.roles_mapping;
43
44 create role r1;
45 grant r1 to u1;
46 --sorted_result
47 select * from mysql.roles_mapping;
48
49 drop user u1;
50 --error ER_NONEXISTING_GRANT
51 show grants for u1;
52 --sorted_result
53 select * from mysql.roles_mapping;
54
55 drop role r1;
56 drop user u2;
57
58 #
59 # MDEV-8614 Assertion `status == 0' failed in add_role_user_mapping_action on RENAME USER
60 #
61 create user foo@localhost;
62 grant create user on *.* to foo@localhost;
63 --connect (con1, localhost, foo,,)
64 create role look, isp, xxx, ppp;
65 rename user current_user to nnnn@'%';
66 drop role look, isp, xxx, ppp;
67 connection default;
68 disconnect con1;
69 drop user nnnn@'%';
70
71 #
72 # MDEV-17964 Assertion `status == 0' failed in add_role_user_mapping_action
73 # upon CREATE USER and DROP ROLE
74 #
75 CREATE USER u@localhost;
76
77 --let $n= 1
78 while ($n < 129)
79 {
80 eval CREATE ROLE r$n;
81 inc $n;
82 }
83
84 CREATE ROLE n;
85 CREATE ROLE d WITH ADMIN n;
86 CREATE ROLE '%' WITH ADMIN u@localhost;
87 DROP ROLE n;
88 CREATE USER 't';
89
90 --let $n= 1
91 while ($n < 129)
92 {
93 eval DROP ROLE r$n;
94 inc $n;
95 }
96
97 DROP ROLE d;
98 DROP ROLE '%';
99 DROP USER 't';
100 DROP USER u@localhost;