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