MySQL 9.1.0
Source Code Documentation
|
#include <cstdint>
#include <string>
#include <unordered_map>
#include <vector>
Go to the source code of this file.
Macros | |
#define | NUM_ACLS 31 |
#define | SELECT_ACL ((Access_bitmask)1 << 0) |
#define | INSERT_ACL ((Access_bitmask)1 << 1) |
#define | UPDATE_ACL ((Access_bitmask)1 << 2) |
#define | DELETE_ACL ((Access_bitmask)1 << 3) |
#define | CREATE_ACL ((Access_bitmask)1 << 4) |
#define | DROP_ACL ((Access_bitmask)1 << 5) |
#define | RELOAD_ACL ((Access_bitmask)1 << 6) |
#define | SHUTDOWN_ACL ((Access_bitmask)1 << 7) |
#define | PROCESS_ACL ((Access_bitmask)1 << 8) |
#define | FILE_ACL ((Access_bitmask)1 << 9) |
#define | GRANT_ACL ((Access_bitmask)1 << 10) |
Set to true by both GRANT GRANT OPTION ... TO ... and GRANT ... TO ... WITH GRANT OPTION. More... | |
#define | REFERENCES_ACL ((Access_bitmask)1 << 11) |
#define | INDEX_ACL ((Access_bitmask)1 << 12) |
#define | ALTER_ACL ((Access_bitmask)1 << 13) |
#define | SHOW_DB_ACL ((Access_bitmask)1 << 14) |
#define | SUPER_ACL ((Access_bitmask)1 << 15) |
#define | CREATE_TMP_ACL ((Access_bitmask)1 << 16) |
#define | LOCK_TABLES_ACL ((Access_bitmask)1 << 17) |
#define | EXECUTE_ACL ((Access_bitmask)1 << 18) |
#define | REPL_SLAVE_ACL ((Access_bitmask)1 << 19) |
#define | REPL_CLIENT_ACL ((Access_bitmask)1 << 20) |
#define | CREATE_VIEW_ACL ((Access_bitmask)1 << 21) |
#define | SHOW_VIEW_ACL ((Access_bitmask)1 << 22) |
#define | CREATE_PROC_ACL ((Access_bitmask)1 << 23) |
#define | ALTER_PROC_ACL ((Access_bitmask)1 << 24) |
#define | CREATE_USER_ACL ((Access_bitmask)1 << 25) |
#define | EVENT_ACL ((Access_bitmask)1 << 26) |
#define | TRIGGER_ACL ((Access_bitmask)1 << 27) |
#define | CREATE_TABLESPACE_ACL ((Access_bitmask)1 << 28) |
#define | CREATE_ROLE_ACL ((Access_bitmask)1 << 29) |
#define | DROP_ROLE_ACL ((Access_bitmask)1 << 30) |
#define | NO_ACCESS ((Access_bitmask)1 << NUM_ACLS) |
#define | ALL_ACCESS (NO_ACCESS - 1) |
#define | DB_OP_ACLS |
Privileges to perform database related operations. More... | |
#define | TABLE_OP_ACLS |
Privileges to perform table related operations. More... | |
#define | PROC_OP_ACLS (ALTER_PROC_ACL | EXECUTE_ACL) |
Privileges to modify or execute stored procedures. More... | |
#define | DB_ACLS (DB_OP_ACLS | GRANT_ACL) |
Represents all privileges which could be granted to users at DB-level. More... | |
#define | TABLE_ACLS (TABLE_OP_ACLS | GRANT_ACL) |
Represents all privileges which could be granted to users at table-level. More... | |
#define | COL_ACLS (SELECT_ACL | INSERT_ACL | UPDATE_ACL | REFERENCES_ACL) |
Represents all privileges which could be granted to users at column-level. More... | |
#define | PROC_ACLS (PROC_OP_ACLS | GRANT_ACL) |
Represents all privileges which could be granted to users for stored procedures. More... | |
#define | SHOW_PROC_ACLS (PROC_OP_ACLS | CREATE_PROC_ACL) |
Represents all privileges which are required to show the stored procedure. More... | |
#define | GLOBAL_ACLS |
Represents all privileges which could be granted to users globally. More... | |
#define | DEFAULT_CREATE_PROC_ACLS (ALTER_PROC_ACL | EXECUTE_ACL) |
#define | TMP_TABLE_ACLS |
Table-level privileges which are automatically "granted" to everyone on existing temporary tables (CREATE_ACL is necessary for ALTER ... RENAME). More... | |
#define | DB_CHUNK0 (SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL) |
#define | DB_CHUNK1 (GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL) |
#define | DB_CHUNK2 (CREATE_TMP_ACL | LOCK_TABLES_ACL) |
#define | DB_CHUNK3 (CREATE_VIEW_ACL | SHOW_VIEW_ACL | CREATE_PROC_ACL | ALTER_PROC_ACL) |
#define | DB_CHUNK4 (EXECUTE_ACL) |
#define | DB_CHUNK5 (EVENT_ACL | TRIGGER_ACL) |
#define | fix_rights_for_db(A) |
#define | get_rights_for_db(A) |
#define | TBL_CHUNK0 DB_CHUNK0 |
#define | TBL_CHUNK1 DB_CHUNK1 |
#define | TBL_CHUNK2 (CREATE_VIEW_ACL | SHOW_VIEW_ACL) |
#define | TBL_CHUNK3 TRIGGER_ACL |
#define | fix_rights_for_table(A) |
#define | get_rights_for_table(A) |
#define | fix_rights_for_column(A) (((A)&7) | (((A) & ~7) << 8)) |
#define | get_rights_for_column(A) (((A)&7) | ((A) >> 8)) |
#define | fix_rights_for_procedure(A) |
#define | get_rights_for_procedure(A) |
Typedefs | |
typedef uint32_t | Access_bitmask |
Variables | |
const std::vector< std::string > | global_acls_vector |
Consts for static privileges. More... | |
const std::unordered_map< std::string, int > | global_acls_map |
Bitmap offsets for static privileges. More... | |
#define ALL_ACCESS (NO_ACCESS - 1) |
#define ALTER_ACL ((Access_bitmask)1 << 13) |
#define ALTER_PROC_ACL ((Access_bitmask)1 << 24) |
#define COL_ACLS (SELECT_ACL | INSERT_ACL | UPDATE_ACL | REFERENCES_ACL) |
Represents all privileges which could be granted to users at column-level.
It essentially represents all the privileges present in the columns_priv table.
#define CREATE_ACL ((Access_bitmask)1 << 4) |
#define CREATE_PROC_ACL ((Access_bitmask)1 << 23) |
#define CREATE_ROLE_ACL ((Access_bitmask)1 << 29) |
#define CREATE_TABLESPACE_ACL ((Access_bitmask)1 << 28) |
#define CREATE_TMP_ACL ((Access_bitmask)1 << 16) |
#define CREATE_USER_ACL ((Access_bitmask)1 << 25) |
#define CREATE_VIEW_ACL ((Access_bitmask)1 << 21) |
#define DB_ACLS (DB_OP_ACLS | GRANT_ACL) |
Represents all privileges which could be granted to users at DB-level.
It essentially represents all the privileges present in the mysql.db table.
#define DB_CHUNK0 (SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL) |
#define DB_CHUNK1 (GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL) |
#define DB_CHUNK2 (CREATE_TMP_ACL | LOCK_TABLES_ACL) |
#define DB_CHUNK3 (CREATE_VIEW_ACL | SHOW_VIEW_ACL | CREATE_PROC_ACL | ALTER_PROC_ACL) |
#define DB_CHUNK4 (EXECUTE_ACL) |
#define DB_CHUNK5 (EVENT_ACL | TRIGGER_ACL) |
#define DB_OP_ACLS |
Privileges to perform database related operations.
Use this macro over DB_ACLS unless there is real need to use additional privileges present in the DB_ACLS
#define DEFAULT_CREATE_PROC_ACLS (ALTER_PROC_ACL | EXECUTE_ACL) |
#define DELETE_ACL ((Access_bitmask)1 << 3) |
#define DROP_ACL ((Access_bitmask)1 << 5) |
#define DROP_ROLE_ACL ((Access_bitmask)1 << 30) |
#define EVENT_ACL ((Access_bitmask)1 << 26) |
#define EXECUTE_ACL ((Access_bitmask)1 << 18) |
#define FILE_ACL ((Access_bitmask)1 << 9) |
#define fix_rights_for_column | ( | A | ) | (((A)&7) | (((A) & ~7) << 8)) |
#define fix_rights_for_db | ( | A | ) |
#define fix_rights_for_procedure | ( | A | ) |
#define fix_rights_for_table | ( | A | ) |
#define get_rights_for_column | ( | A | ) | (((A)&7) | ((A) >> 8)) |
#define get_rights_for_db | ( | A | ) |
#define get_rights_for_procedure | ( | A | ) |
#define get_rights_for_table | ( | A | ) |
#define GLOBAL_ACLS |
Represents all privileges which could be granted to users globally.
It essentially represents all the privileges present in the mysql.user table
#define GRANT_ACL ((Access_bitmask)1 << 10) |
Set to true by both GRANT GRANT OPTION ... TO ... and GRANT ... TO ... WITH GRANT OPTION.
Stored into the relevant column in the priv tables for static privileges. And into the the GRANT_OPTION column for dynamic privilege grants. Note that, once granted GRANT_OPTION applies to all static privs on the same level, i.e. the following: GRANT SELECT ON *.* TO foo; GRANT INSERT ON *.* TO foo WITH GRANT OPTION; is equivalent to: GRANT SELECT,INSERT ON *.* TO foo WITH GRANT OPTION; And is also equivalent to GRANT SELECT,INSERT, GRANT OPTION ON *.* TO foo;
#define INDEX_ACL ((Access_bitmask)1 << 12) |
#define INSERT_ACL ((Access_bitmask)1 << 1) |
#define LOCK_TABLES_ACL ((Access_bitmask)1 << 17) |
#define NO_ACCESS ((Access_bitmask)1 << NUM_ACLS) |
#define NUM_ACLS 31 |
#define PROC_ACLS (PROC_OP_ACLS | GRANT_ACL) |
Represents all privileges which could be granted to users for stored procedures.
It essentially represents all the privileges present in the mysql.procs_priv table.
#define PROC_OP_ACLS (ALTER_PROC_ACL | EXECUTE_ACL) |
Privileges to modify or execute stored procedures.
Use this macro over PROC_ACLS unless there is real need to use additional privileges present in the PROC_ACLS
#define PROCESS_ACL ((Access_bitmask)1 << 8) |
#define REFERENCES_ACL ((Access_bitmask)1 << 11) |
#define RELOAD_ACL ((Access_bitmask)1 << 6) |
#define REPL_CLIENT_ACL ((Access_bitmask)1 << 20) |
#define REPL_SLAVE_ACL ((Access_bitmask)1 << 19) |
#define SELECT_ACL ((Access_bitmask)1 << 0) |
#define SHOW_DB_ACL ((Access_bitmask)1 << 14) |
#define SHOW_PROC_ACLS (PROC_OP_ACLS | CREATE_PROC_ACL) |
Represents all privileges which are required to show the stored procedure.
#define SHOW_VIEW_ACL ((Access_bitmask)1 << 22) |
#define SHUTDOWN_ACL ((Access_bitmask)1 << 7) |
#define SUPER_ACL ((Access_bitmask)1 << 15) |
#define TABLE_ACLS (TABLE_OP_ACLS | GRANT_ACL) |
Represents all privileges which could be granted to users at table-level.
It essentially represents all the privileges present in the mysql.tables_priv table.
#define TABLE_OP_ACLS |
Privileges to perform table related operations.
Use this macro over TABLE_ACLS unless there is real need to use additional privileges present in the DB_ACLS
#define TBL_CHUNK0 DB_CHUNK0 |
#define TBL_CHUNK1 DB_CHUNK1 |
#define TBL_CHUNK2 (CREATE_VIEW_ACL | SHOW_VIEW_ACL) |
#define TBL_CHUNK3 TRIGGER_ACL |
#define TMP_TABLE_ACLS |
Table-level privileges which are automatically "granted" to everyone on existing temporary tables (CREATE_ACL is necessary for ALTER ... RENAME).
#define TRIGGER_ACL ((Access_bitmask)1 << 27) |
#define UPDATE_ACL ((Access_bitmask)1 << 2) |
typedef uint32_t Access_bitmask |
|
extern |
Bitmap offsets for static privileges.
|
extern |
Consts for static privileges.