2019-12-01 22:01:05 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Parsers/IAST.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2020-02-10 02:26:56 +00:00
|
|
|
/// Represents a set of users/roles like
|
|
|
|
/// {user_name | role_name | CURRENT_USER} [,...] | NONE | ALL | ALL EXCEPT {user_name | role_name | CURRENT_USER} [,...]
|
2020-03-07 17:37:38 +00:00
|
|
|
class ASTExtendedRoleSet : public IAST
|
2019-12-01 22:01:05 +00:00
|
|
|
{
|
|
|
|
public:
|
2020-02-10 15:24:33 +00:00
|
|
|
Strings names;
|
2019-12-01 22:01:05 +00:00
|
|
|
bool current_user = false;
|
2020-02-10 15:24:33 +00:00
|
|
|
bool all = false;
|
|
|
|
Strings except_names;
|
2019-12-01 22:01:05 +00:00
|
|
|
bool except_current_user = false;
|
2020-02-21 19:27:12 +00:00
|
|
|
bool id_mode = false; /// If true then `names` and `except_names` keeps UUIDs, not names.
|
2019-12-01 22:01:05 +00:00
|
|
|
|
2020-02-10 15:24:33 +00:00
|
|
|
bool empty() const { return names.empty() && !current_user && !all; }
|
2019-12-01 22:01:05 +00:00
|
|
|
|
2020-03-07 17:37:38 +00:00
|
|
|
String getID(char) const override { return "ExtendedRoleSet"; }
|
|
|
|
ASTPtr clone() const override { return std::make_shared<ASTExtendedRoleSet>(*this); }
|
2019-12-01 22:01:05 +00:00
|
|
|
void formatImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override;
|
|
|
|
};
|
|
|
|
}
|