mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Use "CREATE USER HOST REGEXP" instead of "CREATE USER HOST NAME REGEXP".
This commit is contained in:
parent
ed2562b3f4
commit
12336a9ece
@ -109,7 +109,7 @@ namespace
|
|||||||
{
|
{
|
||||||
if (std::exchange(need_comma, true))
|
if (std::exchange(need_comma, true))
|
||||||
settings.ostr << ", ";
|
settings.ostr << ", ";
|
||||||
settings.ostr << (settings.hilite ? IAST::hilite_keyword : "") << "NAME REGEXP " << (settings.hilite ? IAST::hilite_none : "");
|
settings.ostr << (settings.hilite ? IAST::hilite_keyword : "") << "REGEXP " << (settings.hilite ? IAST::hilite_none : "");
|
||||||
bool need_comma2 = false;
|
bool need_comma2 = false;
|
||||||
for (const auto & host_regexp : name_regexps)
|
for (const auto & host_regexp : name_regexps)
|
||||||
{
|
{
|
||||||
|
@ -13,14 +13,14 @@ class ASTSettingsProfileElements;
|
|||||||
|
|
||||||
/** CREATE USER [IF NOT EXISTS | OR REPLACE] name
|
/** CREATE USER [IF NOT EXISTS | OR REPLACE] name
|
||||||
* [IDENTIFIED [WITH {NO_PASSWORD|PLAINTEXT_PASSWORD|SHA256_PASSWORD|SHA256_HASH|DOUBLE_SHA1_PASSWORD|DOUBLE_SHA1_HASH}] BY {'password'|'hash'}]
|
* [IDENTIFIED [WITH {NO_PASSWORD|PLAINTEXT_PASSWORD|SHA256_PASSWORD|SHA256_HASH|DOUBLE_SHA1_PASSWORD|DOUBLE_SHA1_HASH}] BY {'password'|'hash'}]
|
||||||
* [HOST {LOCAL | NAME 'name' | NAME REGEXP 'name_regexp' | IP 'address' | LIKE 'pattern'} [,...] | ANY | NONE]
|
* [HOST {LOCAL | NAME 'name' | REGEXP 'name_regexp' | IP 'address' | LIKE 'pattern'} [,...] | ANY | NONE]
|
||||||
* [DEFAULT ROLE role [,...]]
|
* [DEFAULT ROLE role [,...]]
|
||||||
* [SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY|WRITABLE] | PROFILE 'profile_name'] [,...]
|
* [SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY|WRITABLE] | PROFILE 'profile_name'] [,...]
|
||||||
*
|
*
|
||||||
* ALTER USER [IF EXISTS] name
|
* ALTER USER [IF EXISTS] name
|
||||||
* [RENAME TO new_name]
|
* [RENAME TO new_name]
|
||||||
* [IDENTIFIED [WITH {PLAINTEXT_PASSWORD|SHA256_PASSWORD|DOUBLE_SHA1_PASSWORD}] BY {'password'|'hash'}]
|
* [IDENTIFIED [WITH {PLAINTEXT_PASSWORD|SHA256_PASSWORD|DOUBLE_SHA1_PASSWORD}] BY {'password'|'hash'}]
|
||||||
* [[ADD|DROP] HOST {LOCAL | NAME 'name' | NAME REGEXP 'name_regexp' | IP 'address' | LIKE 'pattern'} [,...] | ANY | NONE]
|
* [[ADD|DROP] HOST {LOCAL | NAME 'name' | REGEXP 'name_regexp' | IP 'address' | LIKE 'pattern'} [,...] | ANY | NONE]
|
||||||
* [DEFAULT ROLE role [,...] | ALL | ALL EXCEPT role [,...] ]
|
* [DEFAULT ROLE role [,...] | ALL | ALL EXCEPT role [,...] ]
|
||||||
* [SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY|WRITABLE] | PROFILE 'profile_name'] [,...]
|
* [SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY|WRITABLE] | PROFILE 'profile_name'] [,...]
|
||||||
*/
|
*/
|
||||||
|
@ -166,7 +166,7 @@ namespace
|
|||||||
{
|
{
|
||||||
new_hosts.addLocalHost();
|
new_hosts.addLocalHost();
|
||||||
}
|
}
|
||||||
else if (ParserKeyword{"NAME REGEXP"}.ignore(pos, expected))
|
else if (ParserKeyword{"REGEXP"}.ignore(pos, expected))
|
||||||
{
|
{
|
||||||
ASTPtr ast;
|
ASTPtr ast;
|
||||||
if (!ParserList{std::make_unique<ParserStringLiteral>(), std::make_unique<ParserToken>(TokenType::Comma), false}.parse(pos, ast, expected))
|
if (!ParserList{std::make_unique<ParserStringLiteral>(), std::make_unique<ParserToken>(TokenType::Comma), false}.parse(pos, ast, expected))
|
||||||
|
@ -8,13 +8,13 @@ namespace DB
|
|||||||
/** Parses queries like
|
/** Parses queries like
|
||||||
* CREATE USER [IF NOT EXISTS | OR REPLACE] name
|
* CREATE USER [IF NOT EXISTS | OR REPLACE] name
|
||||||
* [IDENTIFIED [WITH {NO_PASSWORD|PLAINTEXT_PASSWORD|SHA256_PASSWORD|SHA256_HASH|DOUBLE_SHA1_PASSWORD|DOUBLE_SHA1_HASH}] BY {'password'|'hash'}]
|
* [IDENTIFIED [WITH {NO_PASSWORD|PLAINTEXT_PASSWORD|SHA256_PASSWORD|SHA256_HASH|DOUBLE_SHA1_PASSWORD|DOUBLE_SHA1_HASH}] BY {'password'|'hash'}]
|
||||||
* [HOST {LOCAL | NAME 'name' | NAME REGEXP 'name_regexp' | IP 'address' | LIKE 'pattern'} [,...] | ANY | NONE]
|
* [HOST {LOCAL | NAME 'name' | REGEXP 'name_regexp' | IP 'address' | LIKE 'pattern'} [,...] | ANY | NONE]
|
||||||
* [SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY|WRITABLE] | PROFILE 'profile_name'] [,...]
|
* [SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY|WRITABLE] | PROFILE 'profile_name'] [,...]
|
||||||
*
|
*
|
||||||
* ALTER USER [IF EXISTS] name
|
* ALTER USER [IF EXISTS] name
|
||||||
* [RENAME TO new_name]
|
* [RENAME TO new_name]
|
||||||
* [IDENTIFIED [WITH {PLAINTEXT_PASSWORD|SHA256_PASSWORD|DOUBLE_SHA1_PASSWORD}] BY {'password'|'hash'}]
|
* [IDENTIFIED [WITH {PLAINTEXT_PASSWORD|SHA256_PASSWORD|DOUBLE_SHA1_PASSWORD}] BY {'password'|'hash'}]
|
||||||
* [[ADD|DROP] HOST {LOCAL | NAME 'name' | NAME REGEXP 'name_regexp' | IP 'address' | LIKE 'pattern'} [,...] | ANY | NONE]
|
* [[ADD|DROP] HOST {LOCAL | NAME 'name' | REGEXP 'name_regexp' | IP 'address' | LIKE 'pattern'} [,...] | ANY | NONE]
|
||||||
* [SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY|WRITABLE] | PROFILE 'profile_name'] [,...]
|
* [SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY|WRITABLE] | PROFILE 'profile_name'] [,...]
|
||||||
*/
|
*/
|
||||||
class ParserCreateUserQuery : public IParserBase
|
class ParserCreateUserQuery : public IParserBase
|
||||||
|
@ -8,10 +8,10 @@ CREATE USER test_user_01075 HOST LOCAL, IP \'2001:db8:11a3:9d7:1f34:8a2e:7a0:765
|
|||||||
CREATE USER test_user_01075 HOST LOCAL
|
CREATE USER test_user_01075 HOST LOCAL
|
||||||
CREATE USER test_user_01075 HOST NONE
|
CREATE USER test_user_01075 HOST NONE
|
||||||
CREATE USER test_user_01075 HOST LIKE \'@.somesite.com\'
|
CREATE USER test_user_01075 HOST LIKE \'@.somesite.com\'
|
||||||
CREATE USER test_user_01075 HOST NAME REGEXP \'.*.anothersite.com\'
|
CREATE USER test_user_01075 HOST REGEXP \'.*.anothersite.com\'
|
||||||
CREATE USER test_user_01075 HOST NAME REGEXP \'.*.anothersite.com\', \'.*.anothersite.org\'
|
CREATE USER test_user_01075 HOST REGEXP \'.*.anothersite.com\', \'.*.anothersite.org\'
|
||||||
CREATE USER test_user_01075 HOST NAME REGEXP \'.*.anothersite2.com\', \'.*.anothersite2.org\'
|
CREATE USER test_user_01075 HOST REGEXP \'.*.anothersite2.com\', \'.*.anothersite2.org\'
|
||||||
CREATE USER test_user_01075 HOST NAME REGEXP \'.*.anothersite3.com\', \'.*.anothersite3.org\'
|
CREATE USER test_user_01075 HOST REGEXP \'.*.anothersite3.com\', \'.*.anothersite3.org\'
|
||||||
CREATE USER `test_user_01075_x@localhost` HOST LOCAL
|
CREATE USER `test_user_01075_x@localhost` HOST LOCAL
|
||||||
CREATE USER test_user_01075_x
|
CREATE USER test_user_01075_x
|
||||||
CREATE USER `test_user_01075_x@192.168.23.15` HOST LIKE \'192.168.23.15\'
|
CREATE USER `test_user_01075_x@192.168.23.15` HOST LIKE \'192.168.23.15\'
|
||||||
|
@ -30,16 +30,16 @@ SHOW CREATE USER test_user_01075;
|
|||||||
ALTER USER test_user_01075 HOST LIKE '@.somesite.com';
|
ALTER USER test_user_01075 HOST LIKE '@.somesite.com';
|
||||||
SHOW CREATE USER test_user_01075;
|
SHOW CREATE USER test_user_01075;
|
||||||
|
|
||||||
ALTER USER test_user_01075 HOST NAME REGEXP '.*\.anothersite\.com';
|
ALTER USER test_user_01075 HOST REGEXP '.*\.anothersite\.com';
|
||||||
SHOW CREATE USER test_user_01075;
|
SHOW CREATE USER test_user_01075;
|
||||||
|
|
||||||
ALTER USER test_user_01075 HOST NAME REGEXP '.*\.anothersite\.com', '.*\.anothersite\.org';
|
ALTER USER test_user_01075 HOST REGEXP '.*\.anothersite\.com', '.*\.anothersite\.org';
|
||||||
SHOW CREATE USER test_user_01075;
|
SHOW CREATE USER test_user_01075;
|
||||||
|
|
||||||
ALTER USER test_user_01075 HOST NAME REGEXP '.*\.anothersite2\.com', NAME REGEXP '.*\.anothersite2\.org';
|
ALTER USER test_user_01075 HOST REGEXP '.*\.anothersite2\.com', REGEXP '.*\.anothersite2\.org';
|
||||||
SHOW CREATE USER test_user_01075;
|
SHOW CREATE USER test_user_01075;
|
||||||
|
|
||||||
ALTER USER test_user_01075 HOST NAME REGEXP '.*\.anothersite3\.com' HOST NAME REGEXP '.*\.anothersite3\.org';
|
ALTER USER test_user_01075 HOST REGEXP '.*\.anothersite3\.com' HOST REGEXP '.*\.anothersite3\.org';
|
||||||
SHOW CREATE USER test_user_01075;
|
SHOW CREATE USER test_user_01075;
|
||||||
|
|
||||||
DROP USER test_user_01075;
|
DROP USER test_user_01075;
|
||||||
|
Loading…
Reference in New Issue
Block a user