1 | #pragma once |
---|---|
2 | |
3 | #include <Access/MultipleAccessStorage.h> |
4 | #include <Poco/AutoPtr.h> |
5 | #include <memory> |
6 | |
7 | |
8 | namespace Poco |
9 | { |
10 | namespace Net |
11 | { |
12 | class IPAddress; |
13 | } |
14 | namespace Util |
15 | { |
16 | class AbstractConfiguration; |
17 | } |
18 | } |
19 | |
20 | namespace DB |
21 | { |
22 | class QuotaContext; |
23 | class QuotaContextFactory; |
24 | struct QuotaUsageInfo; |
25 | class RowPolicyContext; |
26 | class RowPolicyContextFactory; |
27 | |
28 | |
29 | /// Manages access control entities. |
30 | class AccessControlManager : public MultipleAccessStorage |
31 | { |
32 | public: |
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 | |
45 | private: |
46 | std::unique_ptr<QuotaContextFactory> quota_context_factory; |
47 | std::unique_ptr<RowPolicyContextFactory> row_policy_context_factory; |
48 | }; |
49 | |
50 | } |
51 |