mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
rename somem stuff
This commit is contained in:
parent
e111958762
commit
eb8a18304f
@ -1912,9 +1912,9 @@ void ClientBase::processParsedSingleQuery(const String & full_query, const Strin
|
||||
|
||||
if (const auto * create_user_query = parsed_query->as<ASTCreateUserQuery>())
|
||||
{
|
||||
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();
|
||||
|
||||
|
@ -33,7 +33,7 @@ namespace
|
||||
void updateUserFromQueryImpl(
|
||||
User & user,
|
||||
const ASTCreateUserQuery & query,
|
||||
const std::vector<AuthenticationData> auth_data,
|
||||
const std::vector<AuthenticationData> authentication_methods,
|
||||
const std::shared_ptr<ASTUserNameWithHost> & override_name,
|
||||
const std::optional<RolesOrUsersSet> & override_default_roles,
|
||||
const std::optional<SettingsProfileElements> & 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<AuthenticationData> auth_data;
|
||||
if (!query.auth_data.empty())
|
||||
std::vector<AuthenticationData> 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<std::shared_ptr<User>>(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<User>();
|
||||
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<AuthenticationData> auth_data;
|
||||
if (!query.auth_data.empty())
|
||||
std::vector<AuthenticationData> 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,
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
|
@ -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)
|
||||
|
@ -18,16 +18,16 @@ namespace
|
||||
<< quoteString(new_name);
|
||||
}
|
||||
|
||||
void formatAuthenticationData(const std::vector<std::shared_ptr<ASTAuthenticationData>> & auth_data, const IAST::FormatSettings & settings)
|
||||
void formatAuthenticationData(const std::vector<std::shared_ptr<ASTAuthenticationData>> & 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<ASTCreateUserQuery>(*this);
|
||||
res->children.clear();
|
||||
res->auth_data.clear();
|
||||
res->authentication_methods.clear();
|
||||
|
||||
if (names)
|
||||
res->names = std::static_pointer_cast<ASTUserNamesWithHost>(names->clone());
|
||||
@ -189,20 +189,20 @@ ASTPtr ASTCreateUserQuery::clone() const
|
||||
if (settings)
|
||||
res->settings = std::static_pointer_cast<ASTSettingsProfileElements>(settings->clone());
|
||||
|
||||
if (auth_data.empty())
|
||||
if (authentication_methods.empty())
|
||||
{
|
||||
auto ast = std::make_shared<ASTAuthenticationData>();
|
||||
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<ASTAuthenticationData>(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);
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
std::optional<String> new_name;
|
||||
String storage_name;
|
||||
|
||||
std::vector<std::shared_ptr<ASTAuthenticationData>> auth_data;
|
||||
std::vector<std::shared_ptr<ASTAuthenticationData>> authentication_methods;
|
||||
|
||||
std::optional<AllowedClientHosts> hosts;
|
||||
std::optional<AllowedClientHosts> add_hosts;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ TEST_P(ParserTest, parseQuery)
|
||||
{
|
||||
if (input_text.starts_with("ATTACH"))
|
||||
{
|
||||
auto salt = (dynamic_cast<const ASTCreateUserQuery *>(ast.get())->auth_data.back())->getSalt().value_or("");
|
||||
auto salt = (dynamic_cast<const ASTCreateUserQuery *>(ast.get())->authentication_methods.back())->getSalt().value_or("");
|
||||
EXPECT_TRUE(re2::RE2::FullMatch(salt, expected_ast));
|
||||
}
|
||||
else
|
||||
|
@ -64,7 +64,7 @@ TEST_P(ParserKQLTest, parseKQLQuery)
|
||||
if (input_text.starts_with("ATTACH"))
|
||||
{
|
||||
// todo arthur check
|
||||
auto salt = (dynamic_cast<const ASTCreateUserQuery *>(ast.get())->auth_data.back())->getSalt().value_or("");
|
||||
auto salt = (dynamic_cast<const ASTCreateUserQuery *>(ast.get())->authentication_methods.back())->getSalt().value_or("");
|
||||
EXPECT_TRUE(re2::RE2::FullMatch(salt, expected_ast));
|
||||
}
|
||||
else
|
||||
|
@ -112,6 +112,7 @@ void StorageSystemUsers::fillData(MutableColumns & res_columns, ContextPtr conte
|
||||
auto & column_grantees_except_offsets = assert_cast<ColumnArray &>(*res_columns[column_index++]).getOffsets();
|
||||
auto & column_default_database = assert_cast<ColumnString &>(*res_columns[column_index++]);
|
||||
|
||||
// todo arthur check this
|
||||
auto add_row = [&](const String & name,
|
||||
const UUID & id,
|
||||
const String & storage_name,
|
||||
|
Loading…
Reference in New Issue
Block a user