mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
User with allow_ddl=0 cannot do DDL but can grant DDL.
This commit is contained in:
parent
648be453a4
commit
1b3893bcab
@ -457,7 +457,7 @@ bool ContextAccess::checkAccessImpl2(const AccessFlags & flags, const Args &...
|
||||
}
|
||||
}
|
||||
|
||||
if (!params.allow_ddl)
|
||||
if (!params.allow_ddl && !grant_option)
|
||||
{
|
||||
if (flags & precalc.ddl_flags)
|
||||
return access_denied("Cannot execute query. DDL queries are prohibited for the user", ErrorCodes::QUERY_IS_PROHIBITED);
|
||||
|
@ -207,14 +207,10 @@ def test_show_profiles():
|
||||
|
||||
|
||||
def test_allow_ddl():
|
||||
assert "Not enough privileges" in instance.query_and_get_error("CREATE TABLE tbl(a Int32) ENGINE=Log", user="robin")
|
||||
assert "DDL queries are prohibited" in instance.query_and_get_error("CREATE TABLE tbl(a Int32) ENGINE=Log",
|
||||
settings={"allow_ddl": 0})
|
||||
|
||||
assert "Not enough privileges" in instance.query_and_get_error("GRANT CREATE ON tbl TO robin", user="robin")
|
||||
assert "DDL queries are prohibited" in instance.query_and_get_error("GRANT CREATE ON tbl TO robin",
|
||||
settings={"allow_ddl": 0})
|
||||
|
||||
assert "it's necessary to have grant" in instance.query_and_get_error("CREATE TABLE tbl(a Int32) ENGINE=Log", user="robin")
|
||||
assert "it's necessary to have grant" in instance.query_and_get_error("GRANT CREATE ON tbl TO robin", user="robin")
|
||||
assert "DDL queries are prohibited" in instance.query_and_get_error("CREATE TABLE tbl(a Int32) ENGINE=Log", settings={"allow_ddl": 0})
|
||||
|
||||
instance.query("GRANT CREATE ON tbl TO robin")
|
||||
instance.query("CREATE TABLE tbl(a Int32) ENGINE=Log", user="robin")
|
||||
instance.query("DROP TABLE tbl")
|
||||
|
Loading…
Reference in New Issue
Block a user