mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Use ALTER USER DROP HOST instead of ALTER USER REMOVE HOST for consistency.
This commit is contained in:
parent
bc3e2cb48c
commit
d0af31bbcf
@ -195,7 +195,7 @@ void ASTCreateUserQuery::formatImpl(const FormatSettings & format, FormatState &
|
|||||||
if (add_hosts)
|
if (add_hosts)
|
||||||
formatHosts("ADD", *add_hosts, format);
|
formatHosts("ADD", *add_hosts, format);
|
||||||
if (remove_hosts)
|
if (remove_hosts)
|
||||||
formatHosts("REMOVE", *remove_hosts, format);
|
formatHosts("DROP", *remove_hosts, format);
|
||||||
|
|
||||||
if (default_roles)
|
if (default_roles)
|
||||||
formatDefaultRoles(*default_roles, format);
|
formatDefaultRoles(*default_roles, format);
|
||||||
|
@ -19,7 +19,7 @@ class ASTSettingsProfileElements;
|
|||||||
* 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|REMOVE] HOST {LOCAL | NAME 'name' | NAME REGEXP 'name_regexp' | IP 'address' | LIKE 'pattern'} [,...] | ANY | NONE]
|
* [[ADD|DROP] HOST {LOCAL | NAME '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'] [,...]
|
||||||
*/
|
*/
|
||||||
|
@ -318,7 +318,7 @@ bool ParserCreateUserQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
|
|||||||
if (new_name.empty() && parseRenameTo(pos, expected, new_name, new_host_pattern))
|
if (new_name.empty() && parseRenameTo(pos, expected, new_name, new_host_pattern))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (parseHosts(pos, expected, "ADD", add_hosts) || parseHosts(pos, expected, "REMOVE", remove_hosts))
|
if (parseHosts(pos, expected, "ADD", add_hosts) || parseHosts(pos, expected, "DROP", remove_hosts))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ namespace DB
|
|||||||
* 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|REMOVE] HOST {LOCAL | NAME 'name' | NAME REGEXP 'name_regexp' | IP 'address' | LIKE 'pattern'} [,...] | ANY | NONE]
|
* [[ADD|DROP] HOST {LOCAL | NAME '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
|
||||||
|
@ -15,7 +15,7 @@ namespace
|
|||||||
|
|
||||||
boost::algorithm::trim(name);
|
boost::algorithm::trim(name);
|
||||||
|
|
||||||
String pattern = "@";
|
String pattern = "%";
|
||||||
|
|
||||||
if (ParserToken{TokenType::At}.ignore(pos, expected))
|
if (ParserToken{TokenType::At}.ignore(pos, expected))
|
||||||
{
|
{
|
||||||
@ -25,7 +25,7 @@ namespace
|
|||||||
boost::algorithm::trim(pattern);
|
boost::algorithm::trim(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pattern != "@")
|
if (pattern != "%")
|
||||||
name += '@' + pattern;
|
name += '@' + pattern;
|
||||||
|
|
||||||
user_name = std::move(name);
|
user_name = std::move(name);
|
||||||
|
@ -21,10 +21,10 @@ SHOW CREATE USER test_user_01075;
|
|||||||
ALTER USER test_user_01075 ADD HOST IP '127.0.0.1';
|
ALTER USER test_user_01075 ADD HOST IP '127.0.0.1';
|
||||||
SHOW CREATE USER test_user_01075;
|
SHOW CREATE USER test_user_01075;
|
||||||
|
|
||||||
ALTER USER test_user_01075 REMOVE HOST IP '2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d';
|
ALTER USER test_user_01075 DROP HOST IP '2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d';
|
||||||
SHOW CREATE USER test_user_01075;
|
SHOW CREATE USER test_user_01075;
|
||||||
|
|
||||||
ALTER USER test_user_01075 REMOVE HOST NAME 'localhost';
|
ALTER USER test_user_01075 DROP HOST NAME 'localhost';
|
||||||
SHOW CREATE USER test_user_01075;
|
SHOW CREATE USER test_user_01075;
|
||||||
|
|
||||||
ALTER USER test_user_01075 HOST LIKE '@.somesite.com';
|
ALTER USER test_user_01075 HOST LIKE '@.somesite.com';
|
||||||
@ -47,7 +47,7 @@ DROP USER test_user_01075;
|
|||||||
CREATE USER test_user_01075_x@localhost;
|
CREATE USER test_user_01075_x@localhost;
|
||||||
SHOW CREATE USER test_user_01075_x@localhost;
|
SHOW CREATE USER test_user_01075_x@localhost;
|
||||||
|
|
||||||
ALTER USER test_user_01075_x@localhost RENAME TO test_user_01075_x@'@';
|
ALTER USER test_user_01075_x@localhost RENAME TO test_user_01075_x@'%';
|
||||||
SHOW CREATE USER test_user_01075_x;
|
SHOW CREATE USER test_user_01075_x;
|
||||||
|
|
||||||
ALTER USER test_user_01075_x RENAME TO test_user_01075_x@'192.168.23.15';
|
ALTER USER test_user_01075_x RENAME TO test_user_01075_x@'192.168.23.15';
|
||||||
|
Loading…
Reference in New Issue
Block a user