ClickHouse/src/Parsers/ASTShowAccessEntitiesQuery.h
Vitaly Baranov 9fe47df2e8 Support multiple users/roles in SHOW CREATE USER(ROLE, etc.) and SHOW GRANTS FOR commands.
Support syntax "SHOW CREATE USER ALL" and "SHOW GRANTS FOR ALL".
2020-06-15 22:07:47 +03:00

44 lines
1009 B
C++

#pragma once
#include <Parsers/ASTQueryWithOutput.h>
#include <Access/IAccessEntity.h>
namespace DB
{
/// SHOW USERS
/// SHOW [CURRENT|ENABLED] ROLES
/// SHOW [SETTINGS] PROFILES
/// SHOW [ROW] POLICIES [name | ON [database.]table]
/// SHOW QUOTAS
/// SHOW [CURRENT] QUOTA
class ASTShowAccessEntitiesQuery : public ASTQueryWithOutput
{
public:
using EntityType = IAccessEntity::Type;
EntityType type;
bool all = false;
bool current_quota = false;
bool current_roles = false;
bool enabled_roles = false;
String short_name;
std::optional<std::pair<String, String>> database_and_table_name;
String getID(char) const override;
ASTPtr clone() const override { return std::make_shared<ASTShowAccessEntitiesQuery>(*this); }
void replaceEmptyDatabaseWithCurrent(const String & current_database);
protected:
void formatQueryImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override;
private:
String getKeyword() const;
};
}