2019-11-09 15:33:07 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Access/MemoryAccessStorage.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace Poco
|
|
|
|
{
|
|
|
|
namespace Util
|
|
|
|
{
|
|
|
|
class AbstractConfiguration;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
/// Implementation of IAccessStorage which loads all from users.xml periodically.
|
|
|
|
class UsersConfigAccessStorage : public IAccessStorage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UsersConfigAccessStorage();
|
|
|
|
|
2020-02-26 22:36:52 +00:00
|
|
|
void setConfiguration(const Poco::Util::AbstractConfiguration & config);
|
2019-11-09 15:33:07 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::optional<UUID> findImpl(std::type_index type, const String & name) const override;
|
|
|
|
std::vector<UUID> findAllImpl(std::type_index type) const override;
|
|
|
|
bool existsImpl(const UUID & id) const override;
|
|
|
|
AccessEntityPtr readImpl(const UUID & id) const override;
|
|
|
|
String readNameImpl(const UUID & id) const override;
|
2020-02-26 10:50:13 +00:00
|
|
|
bool canInsertImpl(const AccessEntityPtr &) const override { return false; }
|
2019-11-09 15:33:07 +00:00
|
|
|
UUID insertImpl(const AccessEntityPtr & entity, bool replace_if_exists) override;
|
|
|
|
void removeImpl(const UUID & id) override;
|
|
|
|
void updateImpl(const UUID & id, const UpdateFunc & update_func) override;
|
2020-01-29 15:51:12 +00:00
|
|
|
ext::scope_guard subscribeForChangesImpl(const UUID & id, const OnChangedHandler & handler) const override;
|
|
|
|
ext::scope_guard subscribeForChangesImpl(std::type_index type, const OnChangedHandler & handler) const override;
|
2019-11-09 15:33:07 +00:00
|
|
|
bool hasSubscriptionImpl(const UUID & id) const override;
|
|
|
|
bool hasSubscriptionImpl(std::type_index type) const override;
|
|
|
|
|
|
|
|
MemoryAccessStorage memory_storage;
|
|
|
|
};
|
|
|
|
}
|