2020-05-30 20:10:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Parsers/IParserBase.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
/** Parses a string like this:
|
2021-02-26 22:37:00 +00:00
|
|
|
* {user_name | role_name | CURRENT_USER | ALL | NONE} [,...]
|
|
|
|
* [EXCEPT {user_name | role_name | CURRENT_USER | ALL | NONE} [,...]]
|
2020-05-30 20:10:45 +00:00
|
|
|
*/
|
|
|
|
class ParserRolesOrUsersSet : public IParserBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ParserRolesOrUsersSet & allowAll(bool allow_all_ = true) { allow_all = allow_all_; return *this; }
|
2021-03-11 13:44:00 +00:00
|
|
|
ParserRolesOrUsersSet & allowAny(bool allow_any_ = true) { allow_any = allow_any_; return *this; }
|
2021-02-26 22:37:00 +00:00
|
|
|
ParserRolesOrUsersSet & allowUsers(bool allow_users_ = true) { allow_users = allow_users_; return *this; }
|
2020-05-30 20:10:45 +00:00
|
|
|
ParserRolesOrUsersSet & allowCurrentUser(bool allow_current_user_ = true) { allow_current_user = allow_current_user_; return *this; }
|
2021-02-26 22:37:00 +00:00
|
|
|
ParserRolesOrUsersSet & allowRoles(bool allow_roles_ = true) { allow_roles = allow_roles_; return *this; }
|
2020-05-30 20:10:45 +00:00
|
|
|
ParserRolesOrUsersSet & useIDMode(bool id_mode_ = true) { id_mode = id_mode_; return *this; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
const char * getName() const override { return "RolesOrUsersSet"; }
|
|
|
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool allow_all = false;
|
2021-03-11 13:44:00 +00:00
|
|
|
bool allow_any = false;
|
2021-02-26 22:37:00 +00:00
|
|
|
bool allow_users = false;
|
2020-05-30 20:10:45 +00:00
|
|
|
bool allow_current_user = false;
|
2021-02-26 22:37:00 +00:00
|
|
|
bool allow_roles = false;
|
2020-05-30 20:10:45 +00:00
|
|
|
bool id_mode = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|