2021-07-22 16:07:03 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Access/SettingsConstraints.h>
|
|
|
|
#include <Common/SettingsChanges.h>
|
|
|
|
#include <Core/UUID.h>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
struct SettingsConstraintsAndProfileIDs;
|
|
|
|
|
|
|
|
/// Information about the default settings which are applied to an user on login.
|
|
|
|
struct SettingsProfilesInfo
|
|
|
|
{
|
|
|
|
SettingsChanges settings;
|
|
|
|
SettingsConstraints constraints;
|
|
|
|
|
|
|
|
/// Profiles explicitly assigned to the user.
|
|
|
|
std::vector<UUID> profiles;
|
|
|
|
|
|
|
|
/// Profiles assigned to the user both explicitly and implicitly.
|
|
|
|
/// Implicitly assigned profiles include parent profiles of other assigned profiles,
|
|
|
|
/// profiles assigned via granted roles, profiles assigned via their own settings,
|
|
|
|
/// and the main default profile (see the section `default_profile` in the main configuration file).
|
|
|
|
/// The order of IDs in this vector corresponds the order of applying of these profiles.
|
|
|
|
std::vector<UUID> profiles_with_implicit;
|
|
|
|
|
2022-10-25 05:35:10 +00:00
|
|
|
/// Names of all the profiles in `profiles_with_implicit`.
|
2021-07-22 16:07:03 +00:00
|
|
|
std::unordered_map<UUID, String> names_of_profiles;
|
|
|
|
|
2022-03-11 15:52:15 +00:00
|
|
|
explicit SettingsProfilesInfo(const AccessControl & access_control_) : constraints(access_control_), access_control(access_control_) {}
|
2021-07-22 16:07:03 +00:00
|
|
|
std::shared_ptr<const SettingsConstraintsAndProfileIDs> getConstraintsAndProfileIDs(
|
|
|
|
const std::shared_ptr<const SettingsConstraintsAndProfileIDs> & previous = nullptr) const;
|
|
|
|
|
|
|
|
friend bool operator ==(const SettingsProfilesInfo & lhs, const SettingsProfilesInfo & rhs);
|
|
|
|
friend bool operator !=(const SettingsProfilesInfo & lhs, const SettingsProfilesInfo & rhs) { return !(lhs == rhs); }
|
|
|
|
|
2022-10-25 05:35:10 +00:00
|
|
|
Strings getProfileNames() const;
|
2021-03-05 14:57:16 +00:00
|
|
|
|
2021-07-22 16:07:03 +00:00
|
|
|
private:
|
2021-11-02 11:06:20 +00:00
|
|
|
const AccessControl & access_control;
|
2021-07-22 16:07:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|