mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 13:32:13 +00:00
parent
06d94a4dde
commit
9555153f95
@ -19,6 +19,10 @@ class AccessControl;
|
||||
struct SettingsProfileElement
|
||||
{
|
||||
std::optional<UUID> parent_profile;
|
||||
/// parent_profile_xml_name is set only when users are configured via XML
|
||||
/// and is used for user-friendly error messages.
|
||||
std::optional<String> parent_profile_xml_name;
|
||||
|
||||
String setting_name;
|
||||
Field value;
|
||||
Field min_value;
|
||||
|
@ -170,8 +170,15 @@ void SettingsProfilesCache::substituteProfiles(
|
||||
continue;
|
||||
|
||||
auto profile_it = all_profiles.find(profile_id);
|
||||
if (profile_it == all_profiles.end())
|
||||
if (profile_it == all_profiles.end()) {
|
||||
/// If the textual profile name is set, then users are configured via XML.
|
||||
/// For these users we want to throw an exception when their profile can't
|
||||
/// be found. Otherwise, these users are super admins.
|
||||
if (element.parent_profile_xml_name)
|
||||
throw Exception(ErrorCodes::THERE_IS_NO_PROFILE, "There is no profile '{}' in configuration file", *element.parent_profile_xml_name);
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto & profile = profile_it->second;
|
||||
const auto & profile_elements = profile->elements;
|
||||
|
@ -142,6 +142,7 @@ namespace
|
||||
auto profile_name = config.getString(profile_name_config);
|
||||
SettingsProfileElement profile_element;
|
||||
profile_element.parent_profile = generateID(AccessEntityType::SETTINGS_PROFILE, profile_name);
|
||||
profile_element.parent_profile_xml_name = profile_name;
|
||||
user->settings.push_back(std::move(profile_element));
|
||||
}
|
||||
|
||||
@ -473,6 +474,7 @@ namespace
|
||||
String parent_profile_name = config.getString(profile_config + "." + key);
|
||||
SettingsProfileElement profile_element;
|
||||
profile_element.parent_profile = generateID(AccessEntityType::SETTINGS_PROFILE, parent_profile_name);
|
||||
profile_element.parent_profile_xml_name = parent_profile_name;
|
||||
profile->elements.emplace_back(std::move(profile_element));
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user