MySQL 8.0.39
Source Code Documentation
roles.h
Go to the documentation of this file.
1/* Copyright (c) 2019, 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
24#ifndef ROLES_H_INCLUDED
25#define ROLES_H_INCLUDED
26
27// Forward declarations
28class THD;
29struct LEX_USER;
30template <class T>
31class List;
33enum class role_enum;
34
35namespace Roles {
37 public:
39 const List<LEX_USER> *role_list = nullptr,
40 bool raise_error = true);
46
47 bool activate();
48
49 private:
50 bool activate_role_none();
52 bool activate_role_all();
53 bool activate_role_name();
54
55 private:
61 bool m_valid;
62};
63} // namespace Roles
64
65#endif /* ROLES_H_INCLUDED */
Definition: sql_list.h:434
Definition: roles.h:36
const List< LEX_USER > * m_role_list
Definition: roles.h:59
~Role_activation()
Definition: roles.h:45
bool m_valid
Definition: roles.h:61
Role_activation(THD *thd, Security_context *sctx, role_enum type, const List< LEX_USER > *role_list=nullptr, bool raise_error=true)
Constructor.
Definition: roles.cc:52
Role_activation & operator=(Role_activation &&)=delete
THD * m_thd
Definition: roles.h:56
Role_activation & operator=(const Role_activation &)=delete
bool activate()
Activate roles for given session.
Definition: roles.cc:74
Role_activation(const Role_activation &)=delete
bool activate_role_default()
Activate default roles for current session.
Definition: roles.cc:127
bool activate_role_none()
Deactivate all roles for current session.
Definition: roles.cc:102
bool activate_role_name()
Activate roles available through m_role_list.
Definition: roles.cc:282
Security_context * m_sctx
Definition: roles.h:57
bool activate_role_all()
Activate all granted roles - except those specified through m_role_list.
Definition: roles.cc:194
bool m_raise_error
Definition: roles.h:60
Role_activation(Role_activation &&)=delete
role_enum m_type
Definition: roles.h:58
A set of THD members describing the current authenticated user.
Definition: sql_security_ctx.h:55
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
Definition: roles.cc:41
required string type
Definition: replication_group_member_actions.proto:34
role_enum
Definition: sql_admin.h:225
Definition: table.h:2658