MySQL 8.0.40
Source Code Documentation
dynamic_privilege_table.cc File Reference
#include "sql/auth/dynamic_privilege_table.h"
#include <string.h>
#include <memory>
#include <string>
#include "lex_string.h"
#include "m_ctype.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "mysql/components/my_service.h"
#include "mysql/components/service.h"
#include "mysql/components/services/bits/psi_bits.h"
#include "mysql/components/services/dynamic_privilege.h"
#include "mysql/components/services/log_shared.h"
#include "mysql/components/services/registry.h"
#include "mysql/mysql_lex_string.h"
#include "mysql/service_plugin_registry.h"
#include "mysqld_error.h"
#include "sql/auth/auth_common.h"
#include "sql/auth/auth_internal.h"
#include "sql/auth/sql_auth_cache.h"
#include "sql/auth/sql_user_table.h"
#include "sql/current_thd.h"
#include "sql/field.h"
#include "sql/handler.h"
#include "sql/iterators/row_iterator.h"
#include "sql/key.h"
#include "sql/sql_const.h"
#include "sql/sql_executor.h"
#include "sql/table.h"

Macros

#define MYSQL_DYNAMIC_PRIV_FIELD_USER   0
 
#define MYSQL_DYNAMIC_PRIV_FIELD_HOST   1
 
#define MYSQL_DYNAMIC_PRIV_FIELD_PRIV   2
 
#define MYSQL_DYNAMIC_PRIV_FIELD_GRANT   3
 

Functions

Dynamic_privilege_registerget_dynamic_privilege_register (void)
 This function returns a pointer to a global variable allocated on the heap. More...
 
bool populate_dynamic_privilege_caches (THD *thd, Table_ref *tablelst)
 Given an open table handler this function refresh the list of dynamic privilege grants by reading the dynamic_privilege table. More...
 
bool modify_dynamic_privileges_in_table (THD *thd, TABLE *table, const Auth_id_ref &auth_id, const LEX_CSTRING &privilege, bool with_grant_option, bool delete_option)
 Delete or insert a row in the mysql.dynamic_privilege table. More...
 
bool iterate_all_dynamic_privileges (THD *thd, std::function< bool(const char *)> action)
 

Variables

Dynamic_privilege_register g_dynamic_privilege_register
 

Macro Definition Documentation

◆ MYSQL_DYNAMIC_PRIV_FIELD_GRANT

#define MYSQL_DYNAMIC_PRIV_FIELD_GRANT   3

◆ MYSQL_DYNAMIC_PRIV_FIELD_HOST

#define MYSQL_DYNAMIC_PRIV_FIELD_HOST   1

◆ MYSQL_DYNAMIC_PRIV_FIELD_PRIV

#define MYSQL_DYNAMIC_PRIV_FIELD_PRIV   2

◆ MYSQL_DYNAMIC_PRIV_FIELD_USER

#define MYSQL_DYNAMIC_PRIV_FIELD_USER   0

Function Documentation

◆ get_dynamic_privilege_register()

Dynamic_privilege_register * get_dynamic_privilege_register ( void  )

This function returns a pointer to a global variable allocated on the heap.

Returns
A pointer to the dynamic privilege register.

◆ iterate_all_dynamic_privileges()

bool iterate_all_dynamic_privileges ( THD thd,
std::function< bool(const char *)>  action 
)

◆ modify_dynamic_privileges_in_table()

bool modify_dynamic_privileges_in_table ( THD thd,
TABLE table,
const Auth_id_ref auth_id,
const LEX_CSTRING privilege,
bool  with_grant_option,
bool  delete_option 
)

Delete or insert a row in the mysql.dynamic_privilege table.

Parameters
thdThread handler
tableThe opened table to be modified
auth_idTarget authorization ID
privilegePrivilege object ID
with_grant_optionFlag indicating if the grant option is set
delete_optionFlag indicating if this is an insert or delete

If an error has occurred the DA is not set.

See also
Update_dynamic_privilege_table
Returns
Error state
Return values
trueAn error occurred
falseSuccess

◆ populate_dynamic_privilege_caches()

bool populate_dynamic_privilege_caches ( THD thd,
Table_ref tablelst 
)

Given an open table handler this function refresh the list of dynamic privilege grants by reading the dynamic_privilege table.

If an error is raised, this function will set the DA.

Parameters
thdThe thread handle
tablelstAn handle to an open table
Returns
Error state
Return values
trueAn error occurred.
falseSuccess

Variable Documentation

◆ g_dynamic_privilege_register

Dynamic_privilege_register g_dynamic_privilege_register