23#ifndef AUTH_ACLS_INCLUDED
24#define AUTH_ACLS_INCLUDED
27#include <unordered_map>
33#define SELECT_ACL (1L << 0)
34#define INSERT_ACL (1L << 1)
35#define UPDATE_ACL (1L << 2)
36#define DELETE_ACL (1L << 3)
37#define CREATE_ACL (1L << 4)
38#define DROP_ACL (1L << 5)
39#define RELOAD_ACL (1L << 6)
40#define SHUTDOWN_ACL (1L << 7)
41#define PROCESS_ACL (1L << 8)
42#define FILE_ACL (1L << 9)
61#define GRANT_ACL (1L << 10)
62#define REFERENCES_ACL (1L << 11)
63#define INDEX_ACL (1L << 12)
64#define ALTER_ACL (1L << 13)
65#define SHOW_DB_ACL (1L << 14)
66#define SUPER_ACL (1L << 15)
67#define CREATE_TMP_ACL (1L << 16)
68#define LOCK_TABLES_ACL (1L << 17)
69#define EXECUTE_ACL (1L << 18)
70#define REPL_SLAVE_ACL (1L << 19)
71#define REPL_CLIENT_ACL (1L << 20)
72#define CREATE_VIEW_ACL (1L << 21)
73#define SHOW_VIEW_ACL (1L << 22)
74#define CREATE_PROC_ACL (1L << 23)
75#define ALTER_PROC_ACL (1L << 24)
76#define CREATE_USER_ACL (1L << 25)
77#define EVENT_ACL (1L << 26)
78#define TRIGGER_ACL (1L << 27)
79#define CREATE_TABLESPACE_ACL (1L << 28)
80#define CREATE_ROLE_ACL (1L << 29)
81#define DROP_ROLE_ACL (1L << 30)
92#define NO_ACCESS (1L << 31)
100 (UPDATE_ACL | SELECT_ACL | INSERT_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \
101 REFERENCES_ACL | INDEX_ACL | ALTER_ACL | CREATE_TMP_ACL | LOCK_TABLES_ACL | \
102 EXECUTE_ACL | CREATE_VIEW_ACL | SHOW_VIEW_ACL | CREATE_PROC_ACL | \
103 ALTER_PROC_ACL | EVENT_ACL | TRIGGER_ACL)
110#define TABLE_OP_ACLS \
111 (SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \
112 REFERENCES_ACL | INDEX_ACL | ALTER_ACL | CREATE_VIEW_ACL | SHOW_VIEW_ACL | \
120#define PROC_OP_ACLS (ALTER_PROC_ACL | EXECUTE_ACL)
126#define DB_ACLS (DB_OP_ACLS | GRANT_ACL)
133#define TABLE_ACLS (TABLE_OP_ACLS | GRANT_ACL)
139#define COL_ACLS (SELECT_ACL | INSERT_ACL | UPDATE_ACL | REFERENCES_ACL)
146#define PROC_ACLS (PROC_OP_ACLS | GRANT_ACL)
151#define SHOW_PROC_ACLS (PROC_OP_ACLS | CREATE_PROC_ACL)
158 (SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \
159 RELOAD_ACL | SHUTDOWN_ACL | PROCESS_ACL | FILE_ACL | GRANT_ACL | \
160 REFERENCES_ACL | INDEX_ACL | ALTER_ACL | SHOW_DB_ACL | SUPER_ACL | \
161 CREATE_TMP_ACL | LOCK_TABLES_ACL | REPL_SLAVE_ACL | REPL_CLIENT_ACL | \
162 EXECUTE_ACL | CREATE_VIEW_ACL | SHOW_VIEW_ACL | CREATE_PROC_ACL | \
163 ALTER_PROC_ACL | CREATE_USER_ACL | EVENT_ACL | TRIGGER_ACL | \
164 CREATE_TABLESPACE_ACL | CREATE_ROLE_ACL | DROP_ROLE_ACL)
166#define DEFAULT_CREATE_PROC_ACLS (ALTER_PROC_ACL | EXECUTE_ACL)
172#define TMP_TABLE_ACLS \
173 (SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \
174 INDEX_ACL | ALTER_ACL)
183 (SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL)
184#define DB_CHUNK1 (GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL)
185#define DB_CHUNK2 (CREATE_TMP_ACL | LOCK_TABLES_ACL)
187 (CREATE_VIEW_ACL | SHOW_VIEW_ACL | CREATE_PROC_ACL | ALTER_PROC_ACL)
188#define DB_CHUNK4 (EXECUTE_ACL)
189#define DB_CHUNK5 (EVENT_ACL | TRIGGER_ACL)
191#define fix_rights_for_db(A) \
192 (((A)&DB_CHUNK0) | (((A) << 4) & DB_CHUNK1) | (((A) << 6) & DB_CHUNK2) | \
193 (((A) << 9) & DB_CHUNK3) | (((A) << 2) & DB_CHUNK4)) | \
194 (((A) << 9) & DB_CHUNK5)
195#define get_rights_for_db(A) \
196 (((A)&DB_CHUNK0) | (((A)&DB_CHUNK1) >> 4) | (((A)&DB_CHUNK2) >> 6) | \
197 (((A)&DB_CHUNK3) >> 9) | (((A)&DB_CHUNK4) >> 2)) | \
198 (((A)&DB_CHUNK5) >> 9)
199#define TBL_CHUNK0 DB_CHUNK0
200#define TBL_CHUNK1 DB_CHUNK1
201#define TBL_CHUNK2 (CREATE_VIEW_ACL | SHOW_VIEW_ACL)
202#define TBL_CHUNK3 TRIGGER_ACL
203#define fix_rights_for_table(A) \
204 (((A)&TBL_CHUNK0) | (((A) << 4) & TBL_CHUNK1) | (((A) << 11) & TBL_CHUNK2) | \
205 (((A) << 15) & TBL_CHUNK3))
206#define get_rights_for_table(A) \
207 (((A)&TBL_CHUNK0) | (((A)&TBL_CHUNK1) >> 4) | (((A)&TBL_CHUNK2) >> 11) | \
208 (((A)&TBL_CHUNK3) >> 15))
209#define fix_rights_for_column(A) (((A)&7) | (((A) & ~7) << 8))
210#define get_rights_for_column(A) (((A)&7) | ((A) >> 8))
211#define fix_rights_for_procedure(A) \
212 ((((A) << 18) & EXECUTE_ACL) | (((A) << 23) & ALTER_PROC_ACL) | \
213 (((A) << 8) & GRANT_ACL))
214#define get_rights_for_procedure(A) \
215 ((((A)&EXECUTE_ACL) >> 18) | (((A)&ALTER_PROC_ACL) >> 23) | \
216 (((A)&GRANT_ACL) >> 8))
const std::unordered_map< std::string, int > global_acls_map
Bitmap offsets for static privileges.
Definition: auth_acls.cc:96
const std::vector< std::string > global_acls_vector
Consts for static privileges.
Definition: auth_acls.cc:62