aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Interpreters/Access/InterpreterShowAccessQuery.h
blob: d305af9487fa0c8ccc30ec9de1701a0b6c01b871 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once

#include <Interpreters/IInterpreter.h>
#include <Parsers/IAST_fwd.h>


namespace DB
{

struct IAccessEntity;
using AccessEntityPtr = std::shared_ptr<const IAccessEntity>;

/** Return all queries for creating access entities and grants.
  */
class InterpreterShowAccessQuery : public IInterpreter, WithContext
{
public:
    InterpreterShowAccessQuery(const ASTPtr & query_ptr_, ContextPtr context_) : WithContext(context_), query_ptr(query_ptr_) {}

    BlockIO execute() override;

    bool ignoreQuota() const override { return true; }
    bool ignoreLimits() const override { return true; }

private:
    QueryPipeline executeImpl() const;
    ASTs getCreateAndGrantQueries() const;
    std::vector<AccessEntityPtr> getEntities() const;

    ASTPtr query_ptr;
};

}