/sql/auth/sql_authorization.h

https://github.com/mysql/mysql-server · C Header · 51 lines · 24 code · 5 blank · 22 comment · 0 complexity · b32caa2006701cb94cb743c9fd82f253 MD5 · raw file

  1. /* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License, version 2.0,
  4. as published by the Free Software Foundation.
  5. This program is also distributed with certain software (including
  6. but not limited to OpenSSL) that is licensed under separate terms,
  7. as designated in a particular file or component or in included license
  8. documentation. The authors of MySQL hereby grant you an additional
  9. permission to link the program and your derivative works with the
  10. separately licensed software that they have included with MySQL.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License, version 2.0, for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
  18. #ifndef SQL_AUTHORIZATION_INCLUDED
  19. #define SQL_AUTHORIZATION_INCLUDED
  20. #include <functional>
  21. #include <string>
  22. #include <utility>
  23. #include "lex_string.h"
  24. #include "mysql/components/services/mysql_mutex_bits.h"
  25. #include "sql/auth/sql_auth_cache.h"
  26. class String;
  27. class THD;
  28. void roles_graphml(THD *thd, String *);
  29. bool check_if_granted_role(LEX_CSTRING user, LEX_CSTRING host, LEX_CSTRING role,
  30. LEX_CSTRING role_host);
  31. bool find_if_granted_role(Role_vertex_descriptor v, LEX_CSTRING role,
  32. LEX_CSTRING role_host,
  33. Role_vertex_descriptor *found_vertex = nullptr);
  34. void iterate_comma_separated_quoted_string(
  35. std::string str, const std::function<bool(const std::string)> &f);
  36. void get_granted_roles(Role_vertex_descriptor &v,
  37. List_of_granted_roles *granted_roles);
  38. void get_granted_roles(Role_vertex_descriptor &v,
  39. std::function<void(const Role_id &, bool)> f);
  40. /* For for get_mandatory_roles and Sys_mandatory_roles */
  41. extern mysql_mutex_t LOCK_mandatory_roles;
  42. #endif /* SQL_AUTHORIZATION_INCLUDED */