MySQL 8.0.40
Source Code Documentation
sql_user_table.h
Go to the documentation of this file.
1/* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23#ifndef SQL_USER_TABLE_INCLUDED
24#define SQL_USER_TABLE_INCLUDED
25
26#include "my_loglevel.h" // loglevel
27#include "sql/sql_system_table_check.h" // System_table_intact
28
29class THD;
30
31/**
32 Enum for ACL tables.
33 Keep in sync with Acl_table_names
34*/
35typedef enum ACL_TABLES {
46 LAST_ENTRY /* Must always be at the end */
48
49/**
50 Class to validate the flawlessness of ACL table
51 before performing ACL operations.
52*/
54 public:
55 Acl_table_intact(THD *c_thd, enum loglevel log_level = ERROR_LEVEL)
56 : System_table_intact(c_thd, log_level) {}
57
58 /**
59 Checks whether an ACL table is intact.
60
61 Works in conjunction with @ref mysql_acl_table_defs and
62 Table_check_intact::check()
63
64 @param table Table to check.
65 @param acl_table ACL Table "id"
66
67 @retval false OK
68 @retval true There was an error.
69 */
71 return Table_check_intact::check(thd(), table,
73 }
74
75 private:
77};
78
79int handle_grant_table(THD *, Table_ref *tables, ACL_TABLES table_no, bool drop,
80 LEX_USER *user_from, LEX_USER *user_to);
81
82#endif /* SQL_USER_TABLE_INCLUDED */
Class to validate the flawlessness of ACL table before performing ACL operations.
Definition: sql_user_table.h:53
Acl_table_intact(THD *c_thd, enum loglevel log_level=ERROR_LEVEL)
Definition: sql_user_table.h:55
bool check(TABLE *table, ACL_TABLES acl_table)
Checks whether an ACL table is intact.
Definition: sql_user_table.h:70
static const TABLE_FIELD_DEF mysql_acl_table_defs[]
keep in sync with ACL_TABLES
Definition: sql_user_table.h:76
Class to check if system table is intact.
Definition: sql_system_table_check.h:37
THD * thd()
Definition: sql_system_table_check.h:44
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
bool check(THD *thd, TABLE *table, const TABLE_FIELD_DEF *table_def)
Checks whether a table is intact.
Definition: table.cc:3718
Definition: table.h:2791
bool drop(THD *thd, const Table *tp)
Remove SDI for a table.
Definition: sdi.cc:639
Definition of the global "loglevel" enumeration.
loglevel
Definition: my_loglevel.h:41
@ ERROR_LEVEL
Definition: my_loglevel.h:43
Definition: acl_table_base.h:33
ACL_TABLES
Enum for ACL tables.
Definition: sql_user_table.h:35
@ TABLE_PASSWORD_HISTORY
Definition: sql_user_table.h:45
@ TABLE_DEFAULT_ROLES
Definition: sql_user_table.h:43
@ TABLE_PROXIES_PRIV
Definition: sql_user_table.h:41
@ TABLE_DB
Definition: sql_user_table.h:37
@ TABLE_COLUMNS_PRIV
Definition: sql_user_table.h:39
@ TABLE_TABLES_PRIV
Definition: sql_user_table.h:38
@ TABLE_DYNAMIC_PRIV
Definition: sql_user_table.h:44
@ TABLE_ROLE_EDGES
Definition: sql_user_table.h:42
@ LAST_ENTRY
Definition: sql_user_table.h:46
@ TABLE_PROCS_PRIV
Definition: sql_user_table.h:40
@ TABLE_USER
Definition: sql_user_table.h:36
int handle_grant_table(THD *, Table_ref *tables, ACL_TABLES table_no, bool drop, LEX_USER *user_from, LEX_USER *user_to)
Handle a privilege table.
Definition: sql_user_table.cc:2097
Definition: table.h:2658
Definition: table.h:590
Definition: table.h:1399