23#ifndef AUTH_ACLS_INCLUDED
24#define AUTH_ACLS_INCLUDED
28#include <unordered_map>
36#define SELECT_ACL ((Access_bitmask)1 << 0)
37#define INSERT_ACL ((Access_bitmask)1 << 1)
38#define UPDATE_ACL ((Access_bitmask)1 << 2)
39#define DELETE_ACL ((Access_bitmask)1 << 3)
40#define CREATE_ACL ((Access_bitmask)1 << 4)
41#define DROP_ACL ((Access_bitmask)1 << 5)
42#define RELOAD_ACL ((Access_bitmask)1 << 6)
43#define SHUTDOWN_ACL ((Access_bitmask)1 << 7)
44#define PROCESS_ACL ((Access_bitmask)1 << 8)
45#define FILE_ACL ((Access_bitmask)1 << 9)
64#define GRANT_ACL ((Access_bitmask)1 << 10)
65#define REFERENCES_ACL ((Access_bitmask)1 << 11)
66#define INDEX_ACL ((Access_bitmask)1 << 12)
67#define ALTER_ACL ((Access_bitmask)1 << 13)
68#define SHOW_DB_ACL ((Access_bitmask)1 << 14)
69#define SUPER_ACL ((Access_bitmask)1 << 15)
70#define CREATE_TMP_ACL ((Access_bitmask)1 << 16)
71#define LOCK_TABLES_ACL ((Access_bitmask)1 << 17)
72#define EXECUTE_ACL ((Access_bitmask)1 << 18)
73#define REPL_SLAVE_ACL ((Access_bitmask)1 << 19)
74#define REPL_CLIENT_ACL ((Access_bitmask)1 << 20)
75#define CREATE_VIEW_ACL ((Access_bitmask)1 << 21)
76#define SHOW_VIEW_ACL ((Access_bitmask)1 << 22)
77#define CREATE_PROC_ACL ((Access_bitmask)1 << 23)
78#define ALTER_PROC_ACL ((Access_bitmask)1 << 24)
79#define CREATE_USER_ACL ((Access_bitmask)1 << 25)
80#define EVENT_ACL ((Access_bitmask)1 << 26)
81#define TRIGGER_ACL ((Access_bitmask)1 << 27)
82#define CREATE_TABLESPACE_ACL ((Access_bitmask)1 << 28)
83#define CREATE_ROLE_ACL ((Access_bitmask)1 << 29)
84#define DROP_ROLE_ACL ((Access_bitmask)1 << 30)
95#define NO_ACCESS ((Access_bitmask)1 << NUM_ACLS)
96#define ALL_ACCESS (NO_ACCESS - 1)
104 (UPDATE_ACL | SELECT_ACL | INSERT_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \
105 REFERENCES_ACL | INDEX_ACL | ALTER_ACL | CREATE_TMP_ACL | LOCK_TABLES_ACL | \
106 EXECUTE_ACL | CREATE_VIEW_ACL | SHOW_VIEW_ACL | CREATE_PROC_ACL | \
107 ALTER_PROC_ACL | EVENT_ACL | TRIGGER_ACL)
114#define TABLE_OP_ACLS \
115 (SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \
116 REFERENCES_ACL | INDEX_ACL | ALTER_ACL | CREATE_VIEW_ACL | SHOW_VIEW_ACL | \
124#define PROC_OP_ACLS (ALTER_PROC_ACL | EXECUTE_ACL)
130#define DB_ACLS (DB_OP_ACLS | GRANT_ACL)
137#define TABLE_ACLS (TABLE_OP_ACLS | GRANT_ACL)
143#define COL_ACLS (SELECT_ACL | INSERT_ACL | UPDATE_ACL | REFERENCES_ACL)
150#define PROC_ACLS (PROC_OP_ACLS | GRANT_ACL)
155#define SHOW_PROC_ACLS (PROC_OP_ACLS | CREATE_PROC_ACL)
162 (SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \
163 RELOAD_ACL | SHUTDOWN_ACL | PROCESS_ACL | FILE_ACL | GRANT_ACL | \
164 REFERENCES_ACL | INDEX_ACL | ALTER_ACL | SHOW_DB_ACL | SUPER_ACL | \
165 CREATE_TMP_ACL | LOCK_TABLES_ACL | REPL_SLAVE_ACL | REPL_CLIENT_ACL | \
166 EXECUTE_ACL | CREATE_VIEW_ACL | SHOW_VIEW_ACL | CREATE_PROC_ACL | \
167 ALTER_PROC_ACL | CREATE_USER_ACL | EVENT_ACL | TRIGGER_ACL | \
168 CREATE_TABLESPACE_ACL | CREATE_ROLE_ACL | DROP_ROLE_ACL)
170#define DEFAULT_CREATE_PROC_ACLS (ALTER_PROC_ACL | EXECUTE_ACL)
176#define TMP_TABLE_ACLS \
177 (SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \
178 INDEX_ACL | ALTER_ACL)
187 (SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL)
188#define DB_CHUNK1 (GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL)
189#define DB_CHUNK2 (CREATE_TMP_ACL | LOCK_TABLES_ACL)
191 (CREATE_VIEW_ACL | SHOW_VIEW_ACL | CREATE_PROC_ACL | ALTER_PROC_ACL)
192#define DB_CHUNK4 (EXECUTE_ACL)
193#define DB_CHUNK5 (EVENT_ACL | TRIGGER_ACL)
195#define fix_rights_for_db(A) \
196 (((A)&DB_CHUNK0) | (((A) << 4) & DB_CHUNK1) | (((A) << 6) & DB_CHUNK2) | \
197 (((A) << 9) & DB_CHUNK3) | (((A) << 2) & DB_CHUNK4)) | \
198 (((A) << 9) & DB_CHUNK5)
199#define get_rights_for_db(A) \
200 (((A)&DB_CHUNK0) | (((A)&DB_CHUNK1) >> 4) | (((A)&DB_CHUNK2) >> 6) | \
201 (((A)&DB_CHUNK3) >> 9) | (((A)&DB_CHUNK4) >> 2)) | \
202 (((A)&DB_CHUNK5) >> 9)
203#define TBL_CHUNK0 DB_CHUNK0
204#define TBL_CHUNK1 DB_CHUNK1
205#define TBL_CHUNK2 (CREATE_VIEW_ACL | SHOW_VIEW_ACL)
206#define TBL_CHUNK3 TRIGGER_ACL
207#define fix_rights_for_table(A) \
208 (((A)&TBL_CHUNK0) | (((A) << 4) & TBL_CHUNK1) | (((A) << 11) & TBL_CHUNK2) | \
209 (((A) << 15) & TBL_CHUNK3))
210#define get_rights_for_table(A) \
211 (((A)&TBL_CHUNK0) | (((A)&TBL_CHUNK1) >> 4) | (((A)&TBL_CHUNK2) >> 11) | \
212 (((A)&TBL_CHUNK3) >> 15))
213#define fix_rights_for_column(A) (((A)&7) | (((A) & ~7) << 8))
214#define get_rights_for_column(A) (((A)&7) | ((A) >> 8))
215#define fix_rights_for_procedure(A) \
216 ((((A) << 18) & EXECUTE_ACL) | (((A) << 23) & ALTER_PROC_ACL) | \
217 (((A) << 8) & GRANT_ACL))
218#define get_rights_for_procedure(A) \
219 ((((A)&EXECUTE_ACL) >> 18) | (((A)&ALTER_PROC_ACL) >> 23) | \
220 (((A)&GRANT_ACL) >> 8))
const std::unordered_map< std::string, int > global_acls_map
Bitmap offsets for static privileges.
Definition: auth_acls.cc:96
uint32_t Access_bitmask
Definition: auth_acls.h:34
const std::vector< std::string > global_acls_vector
Consts for static privileges.
Definition: auth_acls.cc:62