1#pragma once
2
3#include <Access/MultipleAccessStorage.h>
4#include <Poco/AutoPtr.h>
5#include <memory>
6
7
8namespace Poco
9{
10 namespace Net
11 {
12 class IPAddress;
13 }
14 namespace Util
15 {
16 class AbstractConfiguration;
17 }
18}
19
20namespace DB
21{
22class QuotaContext;
23class QuotaContextFactory;
24struct QuotaUsageInfo;
25class RowPolicyContext;
26class RowPolicyContextFactory;
27
28
29/// Manages access control entities.
30class AccessControlManager : public MultipleAccessStorage
31{
32public:
33 AccessControlManager();
34 ~AccessControlManager();
35
36 void loadFromConfig(const Poco::Util::AbstractConfiguration & users_config);
37
38 std::shared_ptr<QuotaContext>
39 createQuotaContext(const String & user_name, const Poco::Net::IPAddress & address, const String & custom_quota_key);
40
41 std::vector<QuotaUsageInfo> getQuotaUsageInfo() const;
42
43 std::shared_ptr<RowPolicyContext> getRowPolicyContext(const String & user_name) const;
44
45private:
46 std::unique_ptr<QuotaContextFactory> quota_context_factory;
47 std::unique_ptr<RowPolicyContextFactory> row_policy_context_factory;
48};
49
50}
51