26#ifndef ROUTER_SRC_REST_MRS_SRC_MRS_DATABASE_QUERY_CHANGES_AUTHENTICATION_H_
27#define ROUTER_SRC_REST_MRS_SRC_MRS_DATABASE_QUERY_CHANGES_AUTHENTICATION_H_
38template <
typename QueryForAuthApps = v2::QueryEntriesAuthApp,
int version = 2>
47 Parent::audit_log_id_ = last_audit_log_id;
53 uint64_t max_audit_log_id = Parent::audit_log_id_;
57 std::vector<std::string> allowed_changes{
"auth_app",
"auth_vendor",
58 "service_has_auth_app"};
60 if (
version == 3) allowed_changes.push_back(
"service_has_auth_app");
63 Parent::audit_log_id_);
65 for (
const auto &audit_entry : audit_entries.
entries) {
66 auto table = audit_entry.table;
67 if (audit_entry.old_table_id.has_value())
69 audit_entry.old_table_id.value());
71 if (audit_entry.new_table_id.has_value())
73 audit_entry.new_table_id.value());
75 if (max_audit_log_id < audit_entry.id) max_audit_log_id = audit_entry.id;
78 Parent::entries_.swap(local_entries);
80 Parent::audit_log_id_ = max_audit_log_id;
87 Parent::entries_.clear();
91 for (
const auto &
entry : Parent::entries_) {
94 out->push_back(
entry);
98 if (Parent::entries_.empty() &&
table_name ==
"auth_app") {
111 " WHERE subtable.auth_app_id in (SELECT shaa.`auth_app_id` FROM "
112 "`mysql_rest_service_metadata`.`service_has_auth_app` as shaa "
113 " WHERE `shaa`.`service_id`=? ) "};
115 return Parent::query_.str() +
where.str();
121 return Parent::query_.str() +
where.str();
mysqlrouter::MySQLSession MySQLSession
Definition: bootstrap_mysql_account.cc:41
Definition: query_entries_audit_log.h:37
VectorOfAuditEntries entries
Definition: query_entries_audit_log.h:48
virtual uint64_t query_entries(MySQLSession *session, const std::vector< std::string > &allowed_tables, const uint64_t audit_log_id)
Definition: query_entries_audit_log.cc:34
Definition: query_changes_auth_app.h:39
QueryChangesAuthApp(const uint64_t last_audit_log_id)
Definition: query_changes_auth_app.h:46
std::set< entry::UniversalId > entries_fetched
Definition: query_changes_auth_app.h:124
QueryForAuthApps Parent
Definition: query_changes_auth_app.h:41
std::string build_query(std::string table_name, const entry::UniversalId &id)
Definition: query_changes_auth_app.h:107
void query_entries(MySQLSession *session) override
Definition: query_changes_auth_app.h:50
void query_auth_entries(MySQLSession *session, Entries *out, const std::string &table_name, const entry::UniversalId &id)
Definition: query_changes_auth_app.h:84
typename Parent::Entries Entries
Definition: query_changes_auth_app.h:43
UniversalId id
Definition: auth_app.h:43
Definition: mysql_session.h:157
Definition: utils_sqlstring.h:67
static char * query
Definition: myisam_ftdump.cc:47
static char * where
Definition: mysqldump.cc:153
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
mrs::database::entry::AuthApp AuthApp
Definition: oauth2_handler.cc:58
QueryEntriesAuthApp::Entries Entries
Definition: query_entries_auth_app.cc:36
Definition: authorize_manager.h:48
mrs::database::entry::UniversalId UniversalId
Definition: universal_id.h:33
const char * table_name
Definition: rules_table_service.cc:56
required uint64 version
Definition: replication_group_member_actions.proto:41
Definition: completion_hash.h:35
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510