ClickHouse/src/Interpreters/InterpreterShowCreateAccessEntityQuery.h
2021-09-15 22:35:48 +03:00

43 lines
1.1 KiB
C++

#pragma once
#include <Interpreters/IInterpreter.h>
#include <Parsers/IAST_fwd.h>
#include <Core/UUID.h>
namespace DB
{
class AccessControlManager;
class Context;
class AccessRightsElements;
struct IAccessEntity;
using AccessEntityPtr = std::shared_ptr<const IAccessEntity>;
/** Returns a single item containing a statement which could be used to create a specified role.
*/
class InterpreterShowCreateAccessEntityQuery : public IInterpreter, WithContext
{
public:
InterpreterShowCreateAccessEntityQuery(const ASTPtr & query_ptr_, ContextPtr context_);
BlockIO execute() override;
bool ignoreQuota() const override { return true; }
bool ignoreLimits() const override { return true; }
static ASTPtr getCreateQuery(const IAccessEntity & entity, const AccessControlManager & access_control);
static ASTPtr getAttachQuery(const IAccessEntity & entity);
private:
QueryPipeline executeImpl();
std::vector<AccessEntityPtr> getEntities() const;
ASTs getCreateQueries() const;
AccessRightsElements getRequiredAccess() const;
ASTPtr query_ptr;
};
}