ClickHouse/dbms/src/Access/AccessControlManager.h

62 lines
1.6 KiB
C++
Raw Normal View History

#pragma once
#include <Access/MultipleAccessStorage.h>
#include <Poco/AutoPtr.h>
2019-11-04 19:17:27 +00:00
#include <memory>
namespace Poco
{
2019-11-04 19:17:27 +00:00
namespace Net
{
class IPAddress;
}
namespace Util
{
class AbstractConfiguration;
}
}
namespace DB
{
class AccessRightsContext;
using AccessRightsContextPtr = std::shared_ptr<const AccessRightsContext>;
2020-02-12 03:03:33 +00:00
class AccessRightsContextFactory;
class RowPolicyContext;
using RowPolicyContextPtr = std::shared_ptr<const RowPolicyContext>;
class RowPolicyContextFactory;
2019-11-04 19:17:27 +00:00
class QuotaContext;
using QuotaContextPtr = std::shared_ptr<const QuotaContext>;
2019-11-04 19:17:27 +00:00
class QuotaContextFactory;
struct QuotaUsageInfo;
2020-01-12 21:00:55 +00:00
class ClientInfo;
struct Settings;
2019-11-04 19:17:27 +00:00
/// Manages access control entities.
class AccessControlManager : public MultipleAccessStorage
{
public:
AccessControlManager();
~AccessControlManager();
void loadFromConfig(const Poco::Util::AbstractConfiguration & users_config);
2019-11-04 19:17:27 +00:00
2020-02-12 03:03:33 +00:00
AccessRightsContextPtr getAccessRightsContext(
const UUID & user_id, const Settings & settings, const String & current_database, const ClientInfo & client_info) const;
2020-01-12 21:00:55 +00:00
RowPolicyContextPtr getRowPolicyContext(const UUID & user_id) const;
2019-11-04 19:17:27 +00:00
2020-02-12 03:03:33 +00:00
QuotaContextPtr getQuotaContext(
const UUID & user_id, const String & user_name, const Poco::Net::IPAddress & address, const String & custom_quota_key) const;
2019-11-04 19:17:27 +00:00
std::vector<QuotaUsageInfo> getQuotaUsageInfo() const;
private:
2020-02-12 03:03:33 +00:00
std::unique_ptr<AccessRightsContextFactory> access_rights_context_factory;
std::unique_ptr<RowPolicyContextFactory> row_policy_context_factory;
2020-02-12 03:03:33 +00:00
std::unique_ptr<QuotaContextFactory> quota_context_factory;
};
}