2019-12-01 22:01:05 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Interpreters/IInterpreter.h>
|
|
|
|
#include <Parsers/IAST_fwd.h>
|
2020-02-21 19:27:12 +00:00
|
|
|
#include <Core/UUID.h>
|
2019-12-01 22:01:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2021-11-02 11:06:20 +00:00
|
|
|
class AccessControl;
|
2019-12-01 22:01:05 +00:00
|
|
|
class Context;
|
2020-04-05 16:28:52 +00:00
|
|
|
class AccessRightsElements;
|
2020-02-21 19:27:12 +00:00
|
|
|
struct IAccessEntity;
|
2020-06-06 07:21:02 +00:00
|
|
|
using AccessEntityPtr = std::shared_ptr<const IAccessEntity>;
|
2019-12-01 22:01:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
/** Returns a single item containing a statement which could be used to create a specified role.
|
|
|
|
*/
|
2021-04-10 23:33:54 +00:00
|
|
|
class InterpreterShowCreateAccessEntityQuery : public IInterpreter, WithContext
|
2019-12-01 22:01:05 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-04-10 23:33:54 +00:00
|
|
|
InterpreterShowCreateAccessEntityQuery(const ASTPtr & query_ptr_, ContextPtr context_);
|
2019-12-01 22:01:05 +00:00
|
|
|
|
|
|
|
BlockIO execute() override;
|
|
|
|
|
2020-06-10 23:08:37 +00:00
|
|
|
bool ignoreQuota() const override { return true; }
|
|
|
|
bool ignoreLimits() const override { return true; }
|
2019-12-01 22:01:05 +00:00
|
|
|
|
2022-03-21 05:41:33 +00:00
|
|
|
static ASTPtr getCreateQuery(const IAccessEntity & entity, const AccessControl & access_control);
|
2020-02-21 19:27:12 +00:00
|
|
|
static ASTPtr getAttachQuery(const IAccessEntity & entity);
|
2019-12-01 22:01:05 +00:00
|
|
|
|
2020-02-21 19:27:12 +00:00
|
|
|
private:
|
2021-09-15 19:35:48 +00:00
|
|
|
QueryPipeline executeImpl();
|
2020-06-06 07:21:02 +00:00
|
|
|
std::vector<AccessEntityPtr> getEntities() const;
|
|
|
|
ASTs getCreateQueries() const;
|
2020-04-05 16:28:52 +00:00
|
|
|
AccessRightsElements getRequiredAccess() const;
|
2020-02-21 19:27:12 +00:00
|
|
|
|
|
|
|
ASTPtr query_ptr;
|
2019-12-01 22:01:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|