diff --git a/src/Client/ClientBase.cpp b/src/Client/ClientBase.cpp index 10d77d853f5..3024ee64aea 100644 --- a/src/Client/ClientBase.cpp +++ b/src/Client/ClientBase.cpp @@ -1912,9 +1912,9 @@ void ClientBase::processParsedSingleQuery(const String & full_query, const Strin if (const auto * create_user_query = parsed_query->as()) { - if (!create_user_query->attach && !create_user_query->auth_data.empty()) + if (!create_user_query->attach && !create_user_query->authentication_methods.empty()) { - for (const auto & authentication_method : create_user_query->auth_data) + for (const auto & authentication_method : create_user_query->authentication_methods) { auto password = authentication_method->getPassword(); diff --git a/src/Interpreters/Access/InterpreterCreateUserQuery.cpp b/src/Interpreters/Access/InterpreterCreateUserQuery.cpp index a1f8eaa4cb0..5d0d2c434bd 100644 --- a/src/Interpreters/Access/InterpreterCreateUserQuery.cpp +++ b/src/Interpreters/Access/InterpreterCreateUserQuery.cpp @@ -33,7 +33,7 @@ namespace void updateUserFromQueryImpl( User & user, const ASTCreateUserQuery & query, - const std::vector auth_data, + const std::vector authentication_methods, const std::shared_ptr & override_name, const std::optional & override_default_roles, const std::optional & override_settings, @@ -52,13 +52,13 @@ namespace else if (query.names->size() == 1) user.setName(query.names->front()->toString()); - if (!query.attach && !query.alter && auth_data.empty() && !allow_implicit_no_password) + if (!query.attach && !query.alter && authentication_methods.empty() && !allow_implicit_no_password) throw Exception(ErrorCodes::BAD_ARGUMENTS, "Authentication type NO_PASSWORD must " "be explicitly specified, check the setting allow_implicit_no_password " "in the server configuration"); - if (user.authentication_methods.empty() && auth_data.empty()) + if (user.authentication_methods.empty() && authentication_methods.empty()) { user.authentication_methods.emplace_back(); } @@ -68,7 +68,7 @@ namespace user.authentication_methods.clear(); } - for (const auto & authentication_method : auth_data) + for (const auto & authentication_method : authentication_methods) { user.authentication_methods.emplace_back(authentication_method); } @@ -152,12 +152,12 @@ BlockIO InterpreterCreateUserQuery::execute() bool no_password_allowed = access_control.isNoPasswordAllowed(); bool plaintext_password_allowed = access_control.isPlaintextPasswordAllowed(); - std::vector auth_data; - if (!query.auth_data.empty()) + std::vector authentication_methods; + if (!query.authentication_methods.empty()) { - for (const auto & authentication_method_ast : query.auth_data) + for (const auto & authentication_method_ast : query.authentication_methods) { - auth_data.push_back(AuthenticationData::fromAST(*authentication_method_ast, getContext(), !query.attach)); + authentication_methods.push_back(AuthenticationData::fromAST(*authentication_method_ast, getContext(), !query.attach)); } } @@ -224,7 +224,7 @@ BlockIO InterpreterCreateUserQuery::execute() { auto updated_user = typeid_cast>(entity->clone()); updateUserFromQueryImpl( - *updated_user, query, auth_data, {}, default_roles_from_query, settings_from_query, grantees_from_query, + *updated_user, query, authentication_methods, {}, default_roles_from_query, settings_from_query, grantees_from_query, valid_until, query.reset_authentication_methods_to_new, query.replace_authentication_methods, implicit_no_password_allowed, no_password_allowed, plaintext_password_allowed); return updated_user; @@ -245,7 +245,7 @@ BlockIO InterpreterCreateUserQuery::execute() { auto new_user = std::make_shared(); updateUserFromQueryImpl( - *new_user, query, auth_data, name, default_roles_from_query, settings_from_query, RolesOrUsersSet::AllTag{}, + *new_user, query, authentication_methods, name, default_roles_from_query, settings_from_query, RolesOrUsersSet::AllTag{}, valid_until, query.reset_authentication_methods_to_new, query.replace_authentication_methods, implicit_no_password_allowed, no_password_allowed, plaintext_password_allowed); new_users.emplace_back(std::move(new_user)); @@ -286,18 +286,18 @@ BlockIO InterpreterCreateUserQuery::execute() void InterpreterCreateUserQuery::updateUserFromQuery(User & user, const ASTCreateUserQuery & query, bool allow_no_password, bool allow_plaintext_password) { - std::vector auth_data; - if (!query.auth_data.empty()) + std::vector authentication_methods; + if (!query.authentication_methods.empty()) { - for (const auto & authentication_method_ast : query.auth_data) + for (const auto & authentication_method_ast : query.authentication_methods) { - auth_data.emplace_back(AuthenticationData::fromAST(*authentication_method_ast, {}, !query.attach)); + authentication_methods.emplace_back(AuthenticationData::fromAST(*authentication_method_ast, {}, !query.attach)); } } updateUserFromQueryImpl(user, query, - auth_data, + authentication_methods, {}, {}, {}, diff --git a/src/Interpreters/Access/InterpreterShowCreateAccessEntityQuery.cpp b/src/Interpreters/Access/InterpreterShowCreateAccessEntityQuery.cpp index e49cf68727c..ef6ddf1866d 100644 --- a/src/Interpreters/Access/InterpreterShowCreateAccessEntityQuery.cpp +++ b/src/Interpreters/Access/InterpreterShowCreateAccessEntityQuery.cpp @@ -66,7 +66,7 @@ namespace for (const auto & authentication_method : user.authentication_methods) { - query->auth_data.push_back(authentication_method.toAST()); + query->authentication_methods.push_back(authentication_method.toAST()); } if (user.valid_until) diff --git a/src/Parsers/Access/ASTCreateUserQuery.cpp b/src/Parsers/Access/ASTCreateUserQuery.cpp index 86b91fcb6f4..c6e78955711 100644 --- a/src/Parsers/Access/ASTCreateUserQuery.cpp +++ b/src/Parsers/Access/ASTCreateUserQuery.cpp @@ -18,16 +18,16 @@ namespace << quoteString(new_name); } - void formatAuthenticationData(const std::vector> & auth_data, const IAST::FormatSettings & settings) + void formatAuthenticationData(const std::vector> & authentication_methods, const IAST::FormatSettings & settings) { - auth_data[0]->format(settings); + authentication_methods[0]->format(settings); auto settings_with_additional_authentication_method = settings; settings_with_additional_authentication_method.additional_authentication_method = true; - for (auto i = 1u; i < auth_data.size(); i++) + for (auto i = 1u; i < authentication_methods.size(); i++) { - auth_data[i]->format(settings_with_additional_authentication_method); + authentication_methods[i]->format(settings_with_additional_authentication_method); } } @@ -172,7 +172,7 @@ ASTPtr ASTCreateUserQuery::clone() const { auto res = std::make_shared(*this); res->children.clear(); - res->auth_data.clear(); + res->authentication_methods.clear(); if (names) res->names = std::static_pointer_cast(names->clone()); @@ -189,20 +189,20 @@ ASTPtr ASTCreateUserQuery::clone() const if (settings) res->settings = std::static_pointer_cast(settings->clone()); - if (auth_data.empty()) + if (authentication_methods.empty()) { auto ast = std::make_shared(); ast->type = AuthenticationType::NO_PASSWORD; - res->auth_data.push_back(ast); + res->authentication_methods.push_back(ast); res->children.push_back(ast); } else { - for (const auto & authentication_method : auth_data) + for (const auto & authentication_method : authentication_methods) { auto ast_clone = std::static_pointer_cast(authentication_method->clone()); - res->auth_data.push_back(ast_clone); + res->authentication_methods.push_back(ast_clone); res->children.push_back(ast_clone); } } @@ -243,8 +243,8 @@ void ASTCreateUserQuery::formatImpl(const FormatSettings & format, FormatState & if (new_name) formatRenameTo(*new_name, format); - if (!auth_data.empty()) - formatAuthenticationData(auth_data, format); + if (!authentication_methods.empty()) + formatAuthenticationData(authentication_methods, format); if (valid_until) formatValidUntil(*valid_until, format); diff --git a/src/Parsers/Access/ASTCreateUserQuery.h b/src/Parsers/Access/ASTCreateUserQuery.h index 24af6d00ca4..66a31366993 100644 --- a/src/Parsers/Access/ASTCreateUserQuery.h +++ b/src/Parsers/Access/ASTCreateUserQuery.h @@ -49,7 +49,7 @@ public: std::optional new_name; String storage_name; - std::vector> auth_data; + std::vector> authentication_methods; std::optional hosts; std::optional add_hosts; diff --git a/src/Parsers/Access/ParserCreateUserQuery.cpp b/src/Parsers/Access/ParserCreateUserQuery.cpp index 36162086609..13d988e215d 100644 --- a/src/Parsers/Access/ParserCreateUserQuery.cpp +++ b/src/Parsers/Access/ParserCreateUserQuery.cpp @@ -609,7 +609,7 @@ bool ParserCreateUserQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec query->cluster = std::move(cluster); query->names = std::move(names); query->new_name = std::move(new_name); - query->auth_data = std::move(auth_data); + query->authentication_methods = std::move(auth_data); query->hosts = std::move(hosts); query->add_hosts = std::move(add_hosts); query->remove_hosts = std::move(remove_hosts); @@ -622,7 +622,7 @@ bool ParserCreateUserQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec query->reset_authentication_methods_to_new = reset_authentication_methods_to_new.value_or(false); query->replace_authentication_methods = parsed_identified_with; - for (const auto & authentication_method : query->auth_data) + for (const auto & authentication_method : query->authentication_methods) { query->children.push_back(authentication_method); } diff --git a/src/Parsers/tests/gtest_Parser.cpp b/src/Parsers/tests/gtest_Parser.cpp index bd5d39773dd..e2ccdc96c95 100644 --- a/src/Parsers/tests/gtest_Parser.cpp +++ b/src/Parsers/tests/gtest_Parser.cpp @@ -87,7 +87,7 @@ TEST_P(ParserTest, parseQuery) { if (input_text.starts_with("ATTACH")) { - auto salt = (dynamic_cast(ast.get())->auth_data.back())->getSalt().value_or(""); + auto salt = (dynamic_cast(ast.get())->authentication_methods.back())->getSalt().value_or(""); EXPECT_TRUE(re2::RE2::FullMatch(salt, expected_ast)); } else diff --git a/src/Parsers/tests/gtest_common.cpp b/src/Parsers/tests/gtest_common.cpp index bc780e17ffd..0aded8c98f7 100644 --- a/src/Parsers/tests/gtest_common.cpp +++ b/src/Parsers/tests/gtest_common.cpp @@ -64,7 +64,7 @@ TEST_P(ParserKQLTest, parseKQLQuery) if (input_text.starts_with("ATTACH")) { // todo arthur check - auto salt = (dynamic_cast(ast.get())->auth_data.back())->getSalt().value_or(""); + auto salt = (dynamic_cast(ast.get())->authentication_methods.back())->getSalt().value_or(""); EXPECT_TRUE(re2::RE2::FullMatch(salt, expected_ast)); } else diff --git a/src/Storages/System/StorageSystemUsers.cpp b/src/Storages/System/StorageSystemUsers.cpp index e8557efa9f9..bf2078f7bc1 100644 --- a/src/Storages/System/StorageSystemUsers.cpp +++ b/src/Storages/System/StorageSystemUsers.cpp @@ -112,6 +112,7 @@ void StorageSystemUsers::fillData(MutableColumns & res_columns, ContextPtr conte auto & column_grantees_except_offsets = assert_cast(*res_columns[column_index++]).getOffsets(); auto & column_default_database = assert_cast(*res_columns[column_index++]); + // todo arthur check this auto add_row = [&](const String & name, const UUID & id, const String & storage_name,