1 /* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
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 also distributed 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 included with MySQL.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License, version 2.0, for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
22 */
23 
24 #ifndef ACL_CHANGE_NOTIFICATION_INCLUDED
25 #define ACL_CHANGE_NOTIFICATION_INCLUDED
26 
27 #include "my_sqlcommand.h"  // enum_sql_command
28 #include "sql/table.h"      // LEX_USER, LEX_CSTRING, List
29 
30 class Rewrite_params;  // forward declaration
31 
32 class Acl_change_notification {
33  public:
34   struct User {
35     std::string name;
36     std::string host;
UserUser37     User(const LEX_USER &lex_user)
38         : name(lex_user.user.str, lex_user.user.length),
39           host(lex_user.host.str, lex_user.host.length) {}
40   };
41 
42   Acl_change_notification(class THD *thd, enum_sql_command op,
43                           const List<LEX_USER> *users,
44                           Rewrite_params *rewrite_params,
45                           const List<LEX_CSTRING> *dynamic_privs);
46 
47  private:
48   enum_sql_command operation;
49   std::string db;
50   std::vector<User> user_list;
51   std::vector<std::string> dynamic_privilege_list;
52   Rewrite_params *rewrite_params;
53 
54  public:
get_operation()55   enum_sql_command get_operation() const { return operation; }
get_db()56   const std::string &get_db() const { return db; }
get_user_list()57   const std::vector<User> &get_user_list() const { return user_list; }
get_dynamic_privilege_list()58   const std::vector<std::string> &get_dynamic_privilege_list() const {
59     return dynamic_privilege_list;
60   }
get_rewrite_params()61   Rewrite_params *get_rewrite_params() const { return rewrite_params; }
62 };
63 
64 #endif
65