MySQL 8.3.0
Source Code Documentation
partial_revokes.h
Go to the documentation of this file.
1/* Copyright (c) 2018, 2023, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is also distributed with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have included with MySQL.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License, version 2.0, for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef PARTIAL_REVOKES_INCLUDED
24#define PARTIAL_REVOKES_INCLUDED
25
26#include <map>
27#include <memory>
28#include <set>
29#include <unordered_map>
30
31#include "map_helpers.h"
32#include "memory_debugging.h"
33#include "my_inttypes.h"
34#include "my_sqlcommand.h"
37
38// Forward declarations
39class THD;
40class ACL_USER;
41class Json_array;
42class Json_object;
44
45// Alias declarations
46using db_revocations = std::unordered_map<std::string, ulong>;
47using Db_access_map = std::map<std::string, unsigned long>;
48
49/**
50 Abstract class for ACL restrictions.
51*/
53 public:
56 virtual bool is_empty() const = 0;
57 virtual size_t size() const = 0;
58 virtual void clear() = 0;
59};
60
61/**
62 DB Restrictions representation in memory.
63
64 Note that an instance of this class is owned by the security context.
65 Many of the usage pattern of the security context has complex life cycle, it
66 may be using memory allocated through MEM_ROOT. That may lead to an
67 unwarranted memory growth in some circumstances. Therefore, we wish to own the
68 life cycle of the non POD type members in this class. Please allocate them
69 dynamically otherwise you may cause some difficult to find memory leaks.
70
71 @@note : non POD members are allocated when needed but not in constructor to
72 avoid unnecessary memory allocations since it is frequently accessed code
73 path. Onus is on the user to call the APIs safely that is to make sure that if
74 the accessed member in the API is allocated if it was supposed to be.
75
76 DB_restrictions also provides functions to:
77 - Manage DB restrictions
78 - Status functions
79 - Transformation of in memory db restrictions
80*/
82 public:
84 ~DB_restrictions() override;
85
87 DB_restrictions(const DB_restrictions &restrictions);
88 DB_restrictions(DB_restrictions &&restrictions) = delete;
89 DB_restrictions &operator=(const DB_restrictions &restrictions);
91 bool operator==(const DB_restrictions &restrictions) const;
92 void add(const std::string &db_name, const ulong revoke_privs);
93 void add(const DB_restrictions &restrictions);
94 bool add(const Json_object &json_object);
95
96 void remove(const std::string &db_name, const ulong revoke_privs);
97 void remove(const ulong revoke_privs);
98
99 bool find(const std::string &db_name, ulong &access) const;
100 bool is_empty() const override;
101 size_t size() const override;
102 void clear() override;
103 void get_as_json(Json_array &restrictions_array) const;
104 const db_revocations &get() const;
105 bool has_more_restrictions(const DB_restrictions &, ulong) const;
106
107 private:
109 void remove(const ulong remove_restrictions,
110 ulong &restrictions_mask) const noexcept;
112 void copy_restrictions(const DB_restrictions &other);
113
114 private:
115 /**
116 Database restrictions.
117 Dynamically allocating the memory everytime in constructor would be
118 expensive because this is frequently accessed code path. Therefore, we shall
119 allocate the memory when needed later on.
120 */
122};
123
125 assert(m_restrictions != nullptr);
126 return *m_restrictions;
127}
128
130 if (!m_restrictions) {
132 }
133 return m_restrictions;
134}
135
137 assert(m_restrictions != nullptr);
138 return *m_restrictions;
139}
140
142 assert(m_restrictions == nullptr);
143 if (other.m_restrictions) {
145 }
146}
147
148/**
149 Container of all restrictions for a given user.
150
151 Each object created in the MEM_ROOT has to be destroyed manually.
152 It will be the client's responsibility that create the objects.
153*/
155 public:
156 explicit Restrictions();
157
158 Restrictions(const Restrictions &) = default;
162 bool has_more_db_restrictions(const Restrictions &, ulong);
163
165
166 const DB_restrictions &db() const;
167 void set_db(const DB_restrictions &db_restrictions);
168 void clear_db();
169 bool is_empty() const;
170
171 private:
172 /** Database restrictions */
174};
175
176/**
177 Factory class that solely creates an object of type Restrictions_aggregator.
178
179 - The concrete implementations of Restrictions_aggregator cannot be created
180 directly since their constructors are private. This class is declared as
181 friend in those concrete implementations.
182 - It also records the CURRENT_USER in the binlog so that partial_revokes can
183 be executed on the replica with context of current user
184*/
186 public:
187 static std::unique_ptr<Restrictions_aggregator> create(
188 THD *thd, const ACL_USER *acl_user, const char *db, const ulong rights,
189 bool is_grant_revoke_all_on_db);
190
191 static std::unique_ptr<Restrictions_aggregator> create(
192 const Auth_id &grantor, const Auth_id &grantee,
193 const ulong grantor_access, const ulong grantee_access,
194 const DB_restrictions &grantor_restrictions,
195 const DB_restrictions &grantee_restrictions, const ulong required_access,
196 Db_access_map *db_map);
197
198 private:
199 static Auth_id fetch_grantor(const Security_context *sctx);
200 static Auth_id fetch_grantee(const ACL_USER *acl_user);
201 static ulong fetch_grantor_db_access(THD *thd, const char *db);
202 static ulong fetch_grantee_db_access(THD *thd, const ACL_USER *acl_user,
203 const char *db);
204 static void fetch_grantor_access(const Security_context *sctx, const char *db,
205 ulong &global_access,
206 Restrictions &restrictions);
207 static void fetch_grantee_access(const ACL_USER *grantee, ulong &access,
208 Restrictions &restrictions);
209};
210
211/**
212 Base class to perform aggregation of two restriction lists
213
214 Aggregation is required if all of the following requirements are met:
215 1. Partial revocation feature is enabled
216 2. GRANT/REVOKE operation
217 3. Either grantor or grantee or both have restrictions associated with them
218
219 Task of the aggregator is to evaluate updates required for grantee's
220 restriction. Based on restrictions associated with grantor/grantee:
221 A. Add additional restrictions
222 E.g. - GRANT of a new privileges by a grantor who has restrictions for
223 privileges being granted
224 - Creation of restrictions through REVOKE
225 B. Remove some restrictions
226 E.g. - GRANT of existing privileges by a grantor without restrictions
227 - REVOKE of existing privileges
228
229*/
231 public:
233
234 /* interface methods which derived classes have to implement */
235 virtual bool generate(Abstract_restrictions &restrictions) = 0;
236 virtual bool find_if_require_next_level_operation(ulong &rights) const = 0;
237
238 protected:
239 Restrictions_aggregator(const Auth_id &grantor, const Auth_id grantee,
240 const ulong grantor_global_access,
241 const ulong grantee_global_access,
242 const ulong requested_access);
247
249
250 /** Grantor information */
252
253 /** Grantee information */
255
256 /** Global static privileges of grantor */
258
259 /** Global static privileges of grantee */
261
262 /** Privileges that are being granted or revoked */
264
265 /** Internal status of aggregation process */
267};
268
269/**
270 Restriction aggregator for database restrictions.
271 An umbrella class to cover common methods.
272 This is ultimately used for privilege aggregation
273 in case of GRANT/REVOKE of database level privileges.
274*/
276 public:
277 bool generate(Abstract_restrictions &restrictions) override;
278
279 protected:
281 DB_restrictions_aggregator(const Auth_id &grantor, const Auth_id grantee,
282 const ulong grantor_global_access,
283 const ulong grantee_global_access,
284 const DB_restrictions &grantor_restrictions,
285 const DB_restrictions &grantee_restrictions,
286 const ulong requested_access,
287 const Security_context *sctx);
288 bool find_if_require_next_level_operation(ulong &rights) const override;
289
290 /* Helper methods and members for derived classes */
291
293 const ulong grantee_db_access, const ulong grantee_restrictions,
294 const std::string &db_name) noexcept;
295 void set_if_db_level_operation(const ulong requested_access,
296 const ulong restrictions_mask) noexcept;
297 enum class SQL_OP { SET_ROLE, GLOBAL_GRANT };
298 void aggregate_restrictions(SQL_OP sql_op, const Db_access_map *m_db_map,
299 DB_restrictions &restrictions);
300 ulong get_grantee_db_access(const std::string &db_name) const;
301 void get_grantee_db_access(const std::string &db_name, ulong &access) const;
302
303 /** Privileges that needs to be checked further through DB grants */
305
306 /** Database restrictions for grantor */
308
309 /** Database restrictions for grantee */
311
312 /** Security context of the current user */
314
315 private:
316 virtual Status validate() = 0;
317 virtual void aggregate(DB_restrictions &restrictions) = 0;
318};
319
320/**
321 Database restriction aggregator for SET ROLE statement.
322*/
326 const Auth_id &grantor, const Auth_id grantee,
327 const ulong grantor_global_access, const ulong grantee_global_access,
328 const DB_restrictions &grantor_restrictions,
329 const DB_restrictions &grantee_restrictions, const ulong requested_access,
330 Db_access_map *db_map);
331
332 Status validate() override;
333 void aggregate(DB_restrictions &db_restrictions) override;
335
336 private:
338};
339
340/**
341 Restriction aggregator for GRANT statement for GLOBAL privileges.
342*/
346 const Auth_id &grantor, const Auth_id grantee,
347 const ulong grantor_global_access, const ulong grantee_global_access,
348 const DB_restrictions &grantor_restrictions,
349 const DB_restrictions &grantee_restrictions, const ulong requested_access,
350 const Security_context *sctx);
351
352 Status validate() override;
353 void aggregate(DB_restrictions &restrictions) override;
355};
356
359 protected:
361 const Auth_id &grantor, const Auth_id grantee,
362 const ulong grantor_global_access, const ulong grantee_global_access,
363 const DB_restrictions &grantor_restrictions,
364 const DB_restrictions &grantee_restrictions, const ulong requested_access,
365 const Security_context *sctx);
367
368 private:
369 Status validate() override;
370 void aggregate(DB_restrictions &restrictions) override;
372};
373
374/**
375 Restriction aggregator for REVOKE statement over GLOBAL privileges.
376*/
380 const Auth_id &grantor, const Auth_id grantee,
381 const ulong grantor_global_access, const ulong grantee_global_access,
382 const DB_restrictions &grantor_restrictions,
383 const DB_restrictions &grantee_restrictions, const ulong requested_access,
384 const Security_context *sctx);
385 Status validate() override;
386 void aggregate(DB_restrictions &restrictions) override;
388};
389
390/**
391 Restriction aggregator for GRANT statement over database privileges.
392*/
396 const Auth_id &grantor, const Auth_id grantee,
397 const ulong grantor_global_access, const ulong grantee_global_access,
398 const ulong grantor_db_access, const ulong grantee_db_access,
399 const DB_restrictions &grantor_restrictions,
400 const DB_restrictions &grantee_restrictions, const ulong requested_access,
401 bool is_grant_all, const std::string &db_name,
402 const Security_context *sctx);
403
404 void aggregate(DB_restrictions &restrictions) override;
405 Status validate() override;
406
407 /** Aggregator needs to access class members */
409
410 /** Grantor's database privileges */
412
413 /** Grantee's database privileges */
415
416 /** Flag for GRANT ALL ON <db>.* TO ... */
417 const bool m_is_grant_all;
418
419 /** Target database of GRANT */
420 const std::string m_db_name;
421};
422
423/**
424 Restriction aggregator for REVOKE statement for database privileges.
425*/
429 const Auth_id &grantor, const Auth_id grantee,
430 const ulong grantor_global_access, const ulong grantee_global_access,
431 const ulong grantor_db_access, const ulong grantee_db_access,
432 const DB_restrictions &grantor_restrictions,
433 const DB_restrictions &grantee_restrictions, const ulong requested_access,
434 bool is_revoke_all, const std::string &db_name,
435 const Security_context *sctx);
436
437 void aggregate(DB_restrictions &restrictions) override;
438 Status validate() override;
439
440 /** Aggregator needs to access class members */
442
443 /** Grantor's database privileges */
445
446 /** Grantee's database privileges */
448
449 /** Flag for GRANT ALL ON <db>.* TO ... */
450 const bool m_is_revoke_all;
451
452 /** Target database of REVOKE */
453 const std::string m_db_name;
454};
455
456#endif /* PARTIAL_REVOKES_INCLUDED */
std::map< std::string, unsigned long > Db_access_map
Definition: auth_internal.h:65
Definition: sql_auth_cache.h:245
Abstract class for ACL restrictions.
Definition: partial_revokes.h:52
virtual bool is_empty() const =0
virtual void clear()=0
virtual ~Abstract_restrictions()
Abstract restriction destructor.
virtual size_t size() const =0
Abstract_restrictions()
Abstract restriction constructor.
Storage container for default auth ids.
Definition: auth_common.h:1065
Restriction aggregator for GRANT statement over database privileges.
Definition: partial_revokes.h:394
Status validate() override
Validation function for database level grant statement.
Definition: partial_revokes.cc:1292
const std::string m_db_name
Target database of GRANT.
Definition: partial_revokes.h:420
void aggregate(DB_restrictions &restrictions) override
Aggregate restriction lists.
Definition: partial_revokes.cc:1322
const ulong m_grantor_db_access
Grantor's database privileges.
Definition: partial_revokes.h:411
const ulong m_grantee_db_access
Grantee's database privileges.
Definition: partial_revokes.h:414
DB_restrictions_aggregator_db_grant(const Auth_id &grantor, const Auth_id grantee, const ulong grantor_global_access, const ulong grantee_global_access, const ulong grantor_db_access, const ulong grantee_db_access, const DB_restrictions &grantor_restrictions, const DB_restrictions &grantee_restrictions, const ulong requested_access, bool is_grant_all, const std::string &db_name, const Security_context *sctx)
Constructor.
Definition: partial_revokes.cc:1273
const bool m_is_grant_all
Flag for GRANT ALL ON <db>.
Definition: partial_revokes.h:417
Restriction aggregator for REVOKE statement for database privileges.
Definition: partial_revokes.h:427
const ulong m_grantee_db_access
Grantee's database privileges.
Definition: partial_revokes.h:447
Status validate() override
Validation function for database level revoke statement.
Definition: partial_revokes.cc:1389
const ulong m_grantor_db_access
Grantor's database privileges.
Definition: partial_revokes.h:444
const std::string m_db_name
Target database of REVOKE.
Definition: partial_revokes.h:453
void aggregate(DB_restrictions &restrictions) override
Aggregate restriction lists.
Definition: partial_revokes.cc:1422
DB_restrictions_aggregator_db_revoke(const Auth_id &grantor, const Auth_id grantee, const ulong grantor_global_access, const ulong grantee_global_access, const ulong grantor_db_access, const ulong grantee_db_access, const DB_restrictions &grantor_restrictions, const DB_restrictions &grantee_restrictions, const ulong requested_access, bool is_revoke_all, const std::string &db_name, const Security_context *sctx)
Constructor.
Definition: partial_revokes.cc:1370
const bool m_is_revoke_all
Flag for GRANT ALL ON <db>.
Definition: partial_revokes.h:450
Restriction aggregator for GRANT statement for GLOBAL privileges.
Definition: partial_revokes.h:344
void aggregate(DB_restrictions &restrictions) override
Generates DB_restrictions based on the requested access, grantor and grantee's DB_restrictions in the...
Definition: partial_revokes.cc:1065
DB_restrictions_aggregator_global_grant(const Auth_id &grantor, const Auth_id grantee, const ulong grantor_global_access, const ulong grantee_global_access, const DB_restrictions &grantor_restrictions, const DB_restrictions &grantee_restrictions, const ulong requested_access, const Security_context *sctx)
DB_restrictions_aggregator_global_grant constructor.
Definition: partial_revokes.cc:1001
Status validate() override
Evaluates the restrictions list of grantor and grantee, as well as requested privilege.
Definition: partial_revokes.cc:1024
Restriction aggregator for REVOKE statement over GLOBAL privileges.
Definition: partial_revokes.h:378
void aggregate(DB_restrictions &restrictions) override
Clear all the restrictions and changes the status of object to aggregated.
Definition: partial_revokes.cc:1250
Status validate() override
Validate restriction list for REVOKE ALL.
Definition: partial_revokes.cc:1223
DB_restrictions_aggregator_global_revoke_all(const Auth_id &grantor, const Auth_id grantee, const ulong grantor_global_access, const ulong grantee_global_access, const DB_restrictions &grantor_restrictions, const DB_restrictions &grantee_restrictions, const ulong requested_access, const Security_context *sctx)
DB_restrictions_aggregator_global_revoke_all constructor.
Definition: partial_revokes.cc:1210
Definition: partial_revokes.h:358
Status validate_if_grantee_rl_not_empty()
If grantee restrictions_list is not empty then check the following.
Definition: partial_revokes.cc:1166
DB_restrictions_aggregator_global_revoke(const Auth_id &grantor, const Auth_id grantee, const ulong grantor_global_access, const ulong grantee_global_access, const DB_restrictions &grantor_restrictions, const DB_restrictions &grantee_restrictions, const ulong requested_access, const Security_context *sctx)
DB_restrictions_aggregator_global_revoke constructor.
Definition: partial_revokes.cc:1085
Status validate() override
Evaluates the restrictions list of grantor and grantee, as well as requested privilege.
Definition: partial_revokes.cc:1107
void aggregate(DB_restrictions &restrictions) override
Definition: partial_revokes.cc:1142
Database restriction aggregator for SET ROLE statement.
Definition: partial_revokes.h:324
DB_restrictions_aggregator_set_role(const Auth_id &grantor, const Auth_id grantee, const ulong grantor_global_access, const ulong grantee_global_access, const DB_restrictions &grantor_restrictions, const DB_restrictions &grantee_restrictions, const ulong requested_access, Db_access_map *db_map)
DB_restrictions_aggregator_set_role constructor.
Definition: partial_revokes.cc:905
void aggregate(DB_restrictions &db_restrictions) override
Generates DB_restrictions based on the requested access, grantor and grantee's DB_restrictions in the...
Definition: partial_revokes.cc:954
Status validate() override
Evaluates the restrictions list of grantor and grantee, as well as requested privilege.
Definition: partial_revokes.cc:929
Db_access_map * m_db_map
Definition: partial_revokes.h:337
Restriction aggregator for database restrictions.
Definition: partial_revokes.h:275
void aggregate_restrictions(SQL_OP sql_op, const Db_access_map *m_db_map, DB_restrictions &restrictions)
A helper method that aggregates the restrictions for global_grant and set_role operations since both ...
Definition: partial_revokes.cc:750
bool find_if_require_next_level_operation(ulong &rights) const override
Get list of privileges that are not restricted through restriction list.
Definition: partial_revokes.cc:653
virtual Status validate()=0
void set_if_db_level_operation(const ulong requested_access, const ulong restrictions_mask) noexcept
Set privileges that needs to be processed further.
Definition: partial_revokes.cc:712
DB_restrictions m_grantee_rl
Database restrictions for grantee.
Definition: partial_revokes.h:310
DB_restrictions m_grantor_rl
Database restrictions for grantor.
Definition: partial_revokes.h:307
virtual void aggregate(DB_restrictions &restrictions)=0
const Security_context * m_sctx
Security context of the current user.
Definition: partial_revokes.h:313
bool check_db_access_and_restrictions_collision(const ulong grantee_db_access, const ulong grantee_restrictions, const std::string &db_name) noexcept
Check possible descrepancy between DB access being granted and existing restrictions.
Definition: partial_revokes.cc:687
ulong m_privs_not_processed
Privileges that needs to be checked further through DB grants.
Definition: partial_revokes.h:304
SQL_OP
Definition: partial_revokes.h:297
ulong get_grantee_db_access(const std::string &db_name) const
Fetches the grantee's DB access on the specified DB If security context of current user exists and ha...
Definition: partial_revokes.cc:867
bool generate(Abstract_restrictions &restrictions) override
Driver function to aggregate restriction lists.
Definition: partial_revokes.cc:630
DB_restrictions_aggregator(const Auth_id &grantor, const Auth_id grantee, const ulong grantor_global_access, const ulong grantee_global_access, const DB_restrictions &grantor_restrictions, const DB_restrictions &grantee_restrictions, const ulong requested_access, const Security_context *sctx)
Constructor for database level restrictions aggregator.
Definition: partial_revokes.cc:602
DB Restrictions representation in memory.
Definition: partial_revokes.h:81
const db_revocations & get() const
Definition: partial_revokes.h:124
bool has_more_restrictions(const DB_restrictions &, ulong) const
Compare is two restriction list for given privileges.
Definition: partial_revokes.cc:320
void get_as_json(Json_array &restrictions_array) const
Serializer.
Definition: partial_revokes.cc:293
void clear() override
Clear restriction list.
Definition: partial_revokes.cc:283
void remove(const std::string &db_name, const ulong revoke_privs)
Remove given set of privilegs for a database from restriction list.
Definition: partial_revokes.cc:202
size_t size() const override
Status function to get number of entries in restriction list.
Definition: partial_revokes.cc:277
void add(const std::string &db_name, const ulong revoke_privs)
Add given privileges as restricted for the database.
Definition: partial_revokes.cc:117
DB_restrictions & operator=(const DB_restrictions &restrictions)
Assignment operator.
Definition: partial_revokes.cc:76
bool find(const std::string &db_name, ulong &access) const
Get restricted access information for given database.
Definition: partial_revokes.cc:256
bool is_empty() const override
Status function to check if restriction list is empty.
Definition: partial_revokes.cc:272
void copy_restrictions(const DB_restrictions &other)
Definition: partial_revokes.h:141
DB_restrictions()
DB Restrictions constructor.
Definition: partial_revokes.cc:57
db_revocations * m_restrictions
Database restrictions.
Definition: partial_revokes.h:121
db_revocations * create_restrictions_if_needed()
Definition: partial_revokes.h:129
DB_restrictions(DB_restrictions &&restrictions)=delete
db_revocations & db_restrictions()
Definition: partial_revokes.h:136
~DB_restrictions() override
Destructor.
Definition: partial_revokes.cc:69
db_revocations & operator()(void)
Definition: partial_revokes.h:86
bool operator==(const DB_restrictions &restrictions) const
Compare the two restrictions.
Definition: partial_revokes.cc:105
Represents a JSON array container, i.e.
Definition: json_dom.h:514
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:367
Factory class that solely creates an object of type Restrictions_aggregator.
Definition: partial_revokes.h:185
static void fetch_grantee_access(const ACL_USER *grantee, ulong &access, Restrictions &restrictions)
Definition: partial_revokes.cc:551
static ulong fetch_grantee_db_access(THD *thd, const ACL_USER *acl_user, const char *db)
Returns the privileges granted on the DB to the grantee.
Definition: partial_revokes.cc:528
static std::unique_ptr< Restrictions_aggregator > create(THD *thd, const ACL_USER *acl_user, const char *db, const ulong rights, bool is_grant_revoke_all_on_db)
A factory method that creates objects from Restrictions_aggregator hierarchy.
Definition: partial_revokes.cc:374
static ulong fetch_grantor_db_access(THD *thd, const char *db)
Returns the privileges granted on the DB to the grantor.
Definition: partial_revokes.cc:511
static Auth_id fetch_grantee(const ACL_USER *acl_user)
Returns the grantee's user name and host info.
Definition: partial_revokes.cc:492
static void fetch_grantor_access(const Security_context *sctx, const char *db, ulong &global_access, Restrictions &restrictions)
Returns the privileges and restrictions:
Definition: partial_revokes.cc:542
static Auth_id fetch_grantor(const Security_context *sctx)
Returns the grantor user name and host id.
Definition: partial_revokes.cc:475
Base class to perform aggregation of two restriction lists.
Definition: partial_revokes.h:230
Restrictions_aggregator(const Restrictions_aggregator &&)=delete
Restrictions_aggregator & operator=(const Restrictions_aggregator &)=delete
virtual ~Restrictions_aggregator()
Destructor.
const ulong m_grantor_global_access
Global static privileges of grantor.
Definition: partial_revokes.h:257
virtual bool find_if_require_next_level_operation(ulong &rights) const =0
const ulong m_grantee_global_access
Global static privileges of grantee.
Definition: partial_revokes.h:260
const ulong m_requested_access
Privileges that are being granted or revoked.
Definition: partial_revokes.h:263
Restrictions_aggregator(const Restrictions_aggregator &)=delete
Status m_status
Internal status of aggregation process.
Definition: partial_revokes.h:266
Restrictions_aggregator & operator=(const Restrictions_aggregator &&)=delete
virtual bool generate(Abstract_restrictions &restrictions)=0
Restrictions_aggregator(const Auth_id &grantor, const Auth_id grantee, const ulong grantor_global_access, const ulong grantee_global_access, const ulong requested_access)
Constructor.
Definition: partial_revokes.cc:568
const Auth_id m_grantee
Grantee information.
Definition: partial_revokes.h:254
const Auth_id m_grantor
Grantor information.
Definition: partial_revokes.h:251
Status
Definition: partial_revokes.h:248
Container of all restrictions for a given user.
Definition: partial_revokes.h:154
bool has_more_db_restrictions(const Restrictions &, ulong)
Definition: partial_revokes.cc:1482
Restrictions & operator=(const Restrictions &)
Assignment operator for Restrictions.
Definition: partial_revokes.cc:1466
void set_db(const DB_restrictions &db_restrictions)
Set given database restrictions.
Definition: partial_revokes.cc:1491
~Restrictions()
Destructor.
Definition: partial_revokes.cc:1457
Restrictions()
Constructor for Restrictions.
Definition: partial_revokes.cc:1454
void clear_db()
Clear database restrictions.
Definition: partial_revokes.cc:1496
const DB_restrictions & db() const
Get database restrictions.
Definition: partial_revokes.cc:1488
Restrictions(const Restrictions &)=default
DB_restrictions m_db_restrictions
Database restrictions.
Definition: partial_revokes.h:173
bool is_empty() const
Return if restrictions are empty or not.
Definition: partial_revokes.cc:1499
A set of THD members describing the current authenticated user.
Definition: sql_security_ctx.h:52
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:35
Various macros useful for communicating with memory debuggers, such as Valgrind.
Some integer typedefs for easier portability.
const char * db_name
Definition: rules_table_service.cc:54
std::unordered_map< std::string, ulong > db_revocations
Definition: partial_revokes.h:46