MySQL 8.4.0
Source Code Documentation
partial_revokes.h
Go to the documentation of this file.
1/* Copyright (c) 2018, 2024, 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 designed to work 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 either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef PARTIAL_REVOKES_INCLUDED
25#define PARTIAL_REVOKES_INCLUDED
26
27#include <map>
28#include <memory>
29#include <set>
30#include <unordered_map>
31
32#include "map_helpers.h"
33#include "memory_debugging.h"
34#include "my_inttypes.h"
35#include "my_sqlcommand.h"
38
39// Forward declarations
40class THD;
41class ACL_USER;
42class Json_array;
43class Json_object;
45
46// Alias declarations
47using db_revocations = std::unordered_map<std::string, ulong>;
48using Db_access_map = std::map<std::string, unsigned long>;
49
50/**
51 Abstract class for ACL restrictions.
52*/
54 public:
57 virtual bool is_empty() const = 0;
58 virtual size_t size() const = 0;
59 virtual void clear() = 0;
60};
61
62/**
63 DB Restrictions representation in memory.
64
65 Note that an instance of this class is owned by the security context.
66 Many of the usage pattern of the security context has complex life cycle, it
67 may be using memory allocated through MEM_ROOT. That may lead to an
68 unwarranted memory growth in some circumstances. Therefore, we wish to own the
69 life cycle of the non POD type members in this class. Please allocate them
70 dynamically otherwise you may cause some difficult to find memory leaks.
71
72 @@note : non POD members are allocated when needed but not in constructor to
73 avoid unnecessary memory allocations since it is frequently accessed code
74 path. Onus is on the user to call the APIs safely that is to make sure that if
75 the accessed member in the API is allocated if it was supposed to be.
76
77 DB_restrictions also provides functions to:
78 - Manage DB restrictions
79 - Status functions
80 - Transformation of in memory db restrictions
81*/
83 public:
85 ~DB_restrictions() override;
86
88 DB_restrictions(const DB_restrictions &restrictions);
89 DB_restrictions(DB_restrictions &&restrictions) = delete;
90 DB_restrictions &operator=(const DB_restrictions &restrictions);
92 bool operator==(const DB_restrictions &restrictions) const;
93 void add(const std::string &db_name, const ulong revoke_privs);
94 void add(const DB_restrictions &restrictions);
95 bool add(const Json_object &json_object);
96
97 void remove(const std::string &db_name, const ulong revoke_privs);
98 void remove(const ulong revoke_privs);
99
100 bool find(const std::string &db_name, ulong &access) const;
101 bool is_empty() const override;
102 size_t size() const override;
103 void clear() override;
104 void get_as_json(Json_array &restrictions_array) const;
105 const db_revocations &get() const;
106 bool has_more_restrictions(const DB_restrictions &, ulong) const;
107
108 private:
110 void remove(const ulong remove_restrictions,
111 ulong &restrictions_mask) const noexcept;
113 void copy_restrictions(const DB_restrictions &other);
114
115 private:
116 /**
117 Database restrictions.
118 Dynamically allocating the memory everytime in constructor would be
119 expensive because this is frequently accessed code path. Therefore, we shall
120 allocate the memory when needed later on.
121 */
123};
124
126 assert(m_restrictions != nullptr);
127 return *m_restrictions;
128}
129
131 if (!m_restrictions) {
133 }
134 return m_restrictions;
135}
136
138 assert(m_restrictions != nullptr);
139 return *m_restrictions;
140}
141
143 assert(m_restrictions == nullptr);
144 if (other.m_restrictions) {
146 }
147}
148
149/**
150 Container of all restrictions for a given user.
151
152 Each object created in the MEM_ROOT has to be destroyed manually.
153 It will be the client's responsibility that create the objects.
154*/
156 public:
157 explicit Restrictions();
158
159 Restrictions(const Restrictions &) = default;
163 bool has_more_db_restrictions(const Restrictions &, ulong);
164
166
167 const DB_restrictions &db() const;
168 void set_db(const DB_restrictions &db_restrictions);
169 void clear_db();
170 bool is_empty() const;
171
172 private:
173 /** Database restrictions */
175};
176
177/**
178 Factory class that solely creates an object of type Restrictions_aggregator.
179
180 - The concrete implementations of Restrictions_aggregator cannot be created
181 directly since their constructors are private. This class is declared as
182 friend in those concrete implementations.
183 - It also records the CURRENT_USER in the binlog so that partial_revokes can
184 be executed on the replica with context of current user
185*/
187 public:
188 static std::unique_ptr<Restrictions_aggregator> create(
189 THD *thd, const ACL_USER *acl_user, const char *db, const ulong rights,
190 bool is_grant_revoke_all_on_db);
191
192 static std::unique_ptr<Restrictions_aggregator> create(
193 const Auth_id &grantor, const Auth_id &grantee,
194 const ulong grantor_access, const ulong grantee_access,
195 const DB_restrictions &grantor_restrictions,
196 const DB_restrictions &grantee_restrictions, const ulong required_access,
197 Db_access_map *db_map);
198
199 private:
200 static Auth_id fetch_grantor(const Security_context *sctx);
201 static Auth_id fetch_grantee(const ACL_USER *acl_user);
202 static ulong fetch_grantor_db_access(THD *thd, const char *db);
203 static ulong fetch_grantee_db_access(THD *thd, const ACL_USER *acl_user,
204 const char *db);
205 static void fetch_grantor_access(const Security_context *sctx, const char *db,
206 ulong &global_access,
207 Restrictions &restrictions);
208 static void fetch_grantee_access(const ACL_USER *grantee, ulong &access,
209 Restrictions &restrictions);
210};
211
212/**
213 Base class to perform aggregation of two restriction lists
214
215 Aggregation is required if all of the following requirements are met:
216 1. Partial revocation feature is enabled
217 2. GRANT/REVOKE operation
218 3. Either grantor or grantee or both have restrictions associated with them
219
220 Task of the aggregator is to evaluate updates required for grantee's
221 restriction. Based on restrictions associated with grantor/grantee:
222 A. Add additional restrictions
223 E.g. - GRANT of a new privileges by a grantor who has restrictions for
224 privileges being granted
225 - Creation of restrictions through REVOKE
226 B. Remove some restrictions
227 E.g. - GRANT of existing privileges by a grantor without restrictions
228 - REVOKE of existing privileges
229
230*/
232 public:
234
235 /* interface methods which derived classes have to implement */
236 virtual bool generate(Abstract_restrictions &restrictions) = 0;
237 virtual bool find_if_require_next_level_operation(ulong &rights) const = 0;
238
239 protected:
240 Restrictions_aggregator(const Auth_id &grantor, const Auth_id grantee,
241 const ulong grantor_global_access,
242 const ulong grantee_global_access,
243 const ulong requested_access);
248
250
251 /** Grantor information */
253
254 /** Grantee information */
256
257 /** Global static privileges of grantor */
259
260 /** Global static privileges of grantee */
262
263 /** Privileges that are being granted or revoked */
265
266 /** Internal status of aggregation process */
268};
269
270/**
271 Restriction aggregator for database restrictions.
272 An umbrella class to cover common methods.
273 This is ultimately used for privilege aggregation
274 in case of GRANT/REVOKE of database level privileges.
275*/
277 public:
278 bool generate(Abstract_restrictions &restrictions) override;
279
280 protected:
282 DB_restrictions_aggregator(const Auth_id &grantor, const Auth_id grantee,
283 const ulong grantor_global_access,
284 const ulong grantee_global_access,
285 const DB_restrictions &grantor_restrictions,
286 const DB_restrictions &grantee_restrictions,
287 const ulong requested_access,
288 const Security_context *sctx);
289 bool find_if_require_next_level_operation(ulong &rights) const override;
290
291 /* Helper methods and members for derived classes */
292
294 const ulong grantee_db_access, const ulong grantee_restrictions,
295 const std::string &db_name) noexcept;
296 void set_if_db_level_operation(const ulong requested_access,
297 const ulong restrictions_mask) noexcept;
298 enum class SQL_OP { SET_ROLE, GLOBAL_GRANT };
299 void aggregate_restrictions(SQL_OP sql_op, const Db_access_map *m_db_map,
300 DB_restrictions &restrictions);
301 ulong get_grantee_db_access(const std::string &db_name) const;
302 void get_grantee_db_access(const std::string &db_name, ulong &access) const;
303
304 /** Privileges that needs to be checked further through DB grants */
306
307 /** Database restrictions for grantor */
309
310 /** Database restrictions for grantee */
312
313 /** Security context of the current user */
315
316 private:
317 virtual Status validate() = 0;
318 virtual void aggregate(DB_restrictions &restrictions) = 0;
319};
320
321/**
322 Database restriction aggregator for SET ROLE statement.
323*/
327 const Auth_id &grantor, const Auth_id grantee,
328 const ulong grantor_global_access, const ulong grantee_global_access,
329 const DB_restrictions &grantor_restrictions,
330 const DB_restrictions &grantee_restrictions, const ulong requested_access,
331 Db_access_map *db_map);
332
333 Status validate() override;
334 void aggregate(DB_restrictions &db_restrictions) override;
336
337 private:
339};
340
341/**
342 Restriction aggregator for GRANT statement for GLOBAL privileges.
343*/
347 const Auth_id &grantor, const Auth_id grantee,
348 const ulong grantor_global_access, const ulong grantee_global_access,
349 const DB_restrictions &grantor_restrictions,
350 const DB_restrictions &grantee_restrictions, const ulong requested_access,
351 const Security_context *sctx);
352
353 Status validate() override;
354 void aggregate(DB_restrictions &restrictions) override;
356};
357
360 protected:
362 const Auth_id &grantor, const Auth_id grantee,
363 const ulong grantor_global_access, const ulong grantee_global_access,
364 const DB_restrictions &grantor_restrictions,
365 const DB_restrictions &grantee_restrictions, const ulong requested_access,
366 const Security_context *sctx);
368
369 private:
370 Status validate() override;
371 void aggregate(DB_restrictions &restrictions) override;
373};
374
375/**
376 Restriction aggregator for REVOKE statement over GLOBAL privileges.
377*/
381 const Auth_id &grantor, const Auth_id grantee,
382 const ulong grantor_global_access, const ulong grantee_global_access,
383 const DB_restrictions &grantor_restrictions,
384 const DB_restrictions &grantee_restrictions, const ulong requested_access,
385 const Security_context *sctx);
386 Status validate() override;
387 void aggregate(DB_restrictions &restrictions) override;
389};
390
391/**
392 Restriction aggregator for GRANT statement over database privileges.
393*/
397 const Auth_id &grantor, const Auth_id grantee,
398 const ulong grantor_global_access, const ulong grantee_global_access,
399 const ulong grantor_db_access, const ulong grantee_db_access,
400 const DB_restrictions &grantor_restrictions,
401 const DB_restrictions &grantee_restrictions, const ulong requested_access,
402 bool is_grant_all, const std::string &db_name,
403 const Security_context *sctx);
404
405 void aggregate(DB_restrictions &restrictions) override;
406 Status validate() override;
407
408 /** Aggregator needs to access class members */
410
411 /** Grantor's database privileges */
413
414 /** Grantee's database privileges */
416
417 /** Flag for GRANT ALL ON <db>.* TO ... */
418 const bool m_is_grant_all;
419
420 /** Target database of GRANT */
421 const std::string m_db_name;
422};
423
424/**
425 Restriction aggregator for REVOKE statement for database privileges.
426*/
430 const Auth_id &grantor, const Auth_id grantee,
431 const ulong grantor_global_access, const ulong grantee_global_access,
432 const ulong grantor_db_access, const ulong grantee_db_access,
433 const DB_restrictions &grantor_restrictions,
434 const DB_restrictions &grantee_restrictions, const ulong requested_access,
435 bool is_revoke_all, const std::string &db_name,
436 const Security_context *sctx);
437
438 void aggregate(DB_restrictions &restrictions) override;
439 Status validate() override;
440
441 /** Aggregator needs to access class members */
443
444 /** Grantor's database privileges */
446
447 /** Grantee's database privileges */
449
450 /** Flag for GRANT ALL ON <db>.* TO ... */
451 const bool m_is_revoke_all;
452
453 /** Target database of REVOKE */
454 const std::string m_db_name;
455};
456
457#endif /* PARTIAL_REVOKES_INCLUDED */
std::map< std::string, unsigned long > Db_access_map
Definition: auth_internal.h:66
Definition: sql_auth_cache.h:246
Abstract class for ACL restrictions.
Definition: partial_revokes.h:53
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:1062
Restriction aggregator for GRANT statement over database privileges.
Definition: partial_revokes.h:395
Status validate() override
Validation function for database level grant statement.
Definition: partial_revokes.cc:1293
const std::string m_db_name
Target database of GRANT.
Definition: partial_revokes.h:421
void aggregate(DB_restrictions &restrictions) override
Aggregate restriction lists.
Definition: partial_revokes.cc:1323
const ulong m_grantor_db_access
Grantor's database privileges.
Definition: partial_revokes.h:412
const ulong m_grantee_db_access
Grantee's database privileges.
Definition: partial_revokes.h:415
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:1274
const bool m_is_grant_all
Flag for GRANT ALL ON <db>.
Definition: partial_revokes.h:418
Restriction aggregator for REVOKE statement for database privileges.
Definition: partial_revokes.h:428
const ulong m_grantee_db_access
Grantee's database privileges.
Definition: partial_revokes.h:448
Status validate() override
Validation function for database level revoke statement.
Definition: partial_revokes.cc:1390
const ulong m_grantor_db_access
Grantor's database privileges.
Definition: partial_revokes.h:445
const std::string m_db_name
Target database of REVOKE.
Definition: partial_revokes.h:454
void aggregate(DB_restrictions &restrictions) override
Aggregate restriction lists.
Definition: partial_revokes.cc:1423
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:1371
const bool m_is_revoke_all
Flag for GRANT ALL ON <db>.
Definition: partial_revokes.h:451
Restriction aggregator for GRANT statement for GLOBAL privileges.
Definition: partial_revokes.h:345
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:1066
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:1002
Status validate() override
Evaluates the restrictions list of grantor and grantee, as well as requested privilege.
Definition: partial_revokes.cc:1025
Restriction aggregator for REVOKE statement over GLOBAL privileges.
Definition: partial_revokes.h:379
void aggregate(DB_restrictions &restrictions) override
Clear all the restrictions and changes the status of object to aggregated.
Definition: partial_revokes.cc:1251
Status validate() override
Validate restriction list for REVOKE ALL.
Definition: partial_revokes.cc:1224
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:1211
Definition: partial_revokes.h:359
Status validate_if_grantee_rl_not_empty()
If grantee restrictions_list is not empty then check the following.
Definition: partial_revokes.cc:1167
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:1086
Status validate() override
Evaluates the restrictions list of grantor and grantee, as well as requested privilege.
Definition: partial_revokes.cc:1108
void aggregate(DB_restrictions &restrictions) override
Definition: partial_revokes.cc:1143
Database restriction aggregator for SET ROLE statement.
Definition: partial_revokes.h:325
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:906
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:955
Status validate() override
Evaluates the restrictions list of grantor and grantee, as well as requested privilege.
Definition: partial_revokes.cc:930
Db_access_map * m_db_map
Definition: partial_revokes.h:338
Restriction aggregator for database restrictions.
Definition: partial_revokes.h:276
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:751
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:654
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:713
DB_restrictions m_grantee_rl
Database restrictions for grantee.
Definition: partial_revokes.h:311
DB_restrictions m_grantor_rl
Database restrictions for grantor.
Definition: partial_revokes.h:308
virtual void aggregate(DB_restrictions &restrictions)=0
const Security_context * m_sctx
Security context of the current user.
Definition: partial_revokes.h:314
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:688
ulong m_privs_not_processed
Privileges that needs to be checked further through DB grants.
Definition: partial_revokes.h:305
SQL_OP
Definition: partial_revokes.h:298
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:868
bool generate(Abstract_restrictions &restrictions) override
Driver function to aggregate restriction lists.
Definition: partial_revokes.cc:631
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:603
DB Restrictions representation in memory.
Definition: partial_revokes.h:82
const db_revocations & get() const
Definition: partial_revokes.h:125
bool has_more_restrictions(const DB_restrictions &, ulong) const
Compare is two restriction list for given privileges.
Definition: partial_revokes.cc:321
void get_as_json(Json_array &restrictions_array) const
Serializer.
Definition: partial_revokes.cc:294
void clear() override
Clear restriction list.
Definition: partial_revokes.cc:284
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:203
size_t size() const override
Status function to get number of entries in restriction list.
Definition: partial_revokes.cc:278
void add(const std::string &db_name, const ulong revoke_privs)
Add given privileges as restricted for the database.
Definition: partial_revokes.cc:118
DB_restrictions & operator=(const DB_restrictions &restrictions)
Assignment operator.
Definition: partial_revokes.cc:77
bool find(const std::string &db_name, ulong &access) const
Get restricted access information for given database.
Definition: partial_revokes.cc:257
bool is_empty() const override
Status function to check if restriction list is empty.
Definition: partial_revokes.cc:273
void copy_restrictions(const DB_restrictions &other)
Definition: partial_revokes.h:142
DB_restrictions()
DB Restrictions constructor.
Definition: partial_revokes.cc:58
db_revocations * m_restrictions
Database restrictions.
Definition: partial_revokes.h:122
db_revocations * create_restrictions_if_needed()
Definition: partial_revokes.h:130
DB_restrictions(DB_restrictions &&restrictions)=delete
db_revocations & db_restrictions()
Definition: partial_revokes.h:137
~DB_restrictions() override
Destructor.
Definition: partial_revokes.cc:70
db_revocations & operator()(void)
Definition: partial_revokes.h:87
bool operator==(const DB_restrictions &restrictions) const
Compare the two restrictions.
Definition: partial_revokes.cc:106
Represents a JSON array container, i.e.
Definition: json_dom.h:516
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:369
Factory class that solely creates an object of type Restrictions_aggregator.
Definition: partial_revokes.h:186
static void fetch_grantee_access(const ACL_USER *grantee, ulong &access, Restrictions &restrictions)
Definition: partial_revokes.cc:552
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:529
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:375
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:512
static Auth_id fetch_grantee(const ACL_USER *acl_user)
Returns the grantee's user name and host info.
Definition: partial_revokes.cc:493
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:543
static Auth_id fetch_grantor(const Security_context *sctx)
Returns the grantor user name and host id.
Definition: partial_revokes.cc:476
Base class to perform aggregation of two restriction lists.
Definition: partial_revokes.h:231
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:258
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:261
const ulong m_requested_access
Privileges that are being granted or revoked.
Definition: partial_revokes.h:264
Restrictions_aggregator(const Restrictions_aggregator &)=delete
Status m_status
Internal status of aggregation process.
Definition: partial_revokes.h:267
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:569
const Auth_id m_grantee
Grantee information.
Definition: partial_revokes.h:255
const Auth_id m_grantor
Grantor information.
Definition: partial_revokes.h:252
Status
Definition: partial_revokes.h:249
Container of all restrictions for a given user.
Definition: partial_revokes.h:155
bool has_more_db_restrictions(const Restrictions &, ulong)
Definition: partial_revokes.cc:1483
Restrictions & operator=(const Restrictions &)
Assignment operator for Restrictions.
Definition: partial_revokes.cc:1467
void set_db(const DB_restrictions &db_restrictions)
Set given database restrictions.
Definition: partial_revokes.cc:1492
~Restrictions()
Destructor.
Definition: partial_revokes.cc:1458
Restrictions()
Constructor for Restrictions.
Definition: partial_revokes.cc:1455
void clear_db()
Clear database restrictions.
Definition: partial_revokes.cc:1497
const DB_restrictions & db() const
Get database restrictions.
Definition: partial_revokes.cc:1489
Restrictions(const Restrictions &)=default
DB_restrictions m_db_restrictions
Database restrictions.
Definition: partial_revokes.h:174
bool is_empty() const
Return if restrictions are empty or not.
Definition: partial_revokes.cc:1500
A set of THD members describing the current authenticated user.
Definition: sql_security_ctx.h:53
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
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:55
std::unordered_map< std::string, ulong > db_revocations
Definition: partial_revokes.h:47