ClickHouse/src/Parsers/ASTRolesOrUsersSet.h

36 lines
1.2 KiB
C++
Raw Normal View History

2019-12-01 22:01:05 +00:00
#pragma once
#include <Parsers/IAST.h>
namespace DB
{
2020-09-15 09:55:57 +00:00
using Strings = std::vector<String>;
/// Represents a set of users/roles like
/// {user_name | role_name | CURRENT_USER | ALL | NONE} [,...]
/// [EXCEPT {user_name | role_name | CURRENT_USER | ALL | NONE} [,...]]
class ASTRolesOrUsersSet : public IAST
2019-12-01 22:01:05 +00:00
{
public:
bool all = false;
Strings names;
2019-12-01 22:01:05 +00:00
bool current_user = false;
Strings except_names;
2019-12-01 22:01:05 +00:00
bool except_current_user = false;
bool allow_users = true; /// whether this set can contain names of users
bool allow_roles = true; /// whether this set can contain names of roles
bool id_mode = false; /// whether this set keep UUIDs instead of names
bool use_keyword_any = false; /// whether the keyword ANY should be used instead of the keyword ALL
2019-12-01 22:01:05 +00:00
bool empty() const { return names.empty() && !current_user && !all; }
void replaceCurrentUserTag(const String & current_user_name);
2019-12-01 22:01:05 +00:00
String getID(char) const override { return "RolesOrUsersSet"; }
ASTPtr clone() const override { return std::make_shared<ASTRolesOrUsersSet>(*this); }
2019-12-01 22:01:05 +00:00
void formatImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override;
};
}