mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
Merge pull request #12015 from vitlibar/fix-access-rights-allow-ddl-0
Fix calculation of access rights when allow_ddl = 0
This commit is contained in:
commit
f3f005d5b9
@ -428,7 +428,7 @@ boost::shared_ptr<const AccessRights> ContextAccess::calculateResultAccess(bool
|
||||
merged_access->revoke(AccessType::CREATE_TEMPORARY_TABLE);
|
||||
}
|
||||
|
||||
if (!allow_ddl_ && !grant_option)
|
||||
if (!allow_ddl_)
|
||||
merged_access->revoke(table_and_dictionary_ddl);
|
||||
|
||||
if (!allow_introspection_ && !grant_option)
|
||||
|
@ -164,6 +164,18 @@ def test_show_profiles():
|
||||
assert expected_access in instance.query("SHOW ACCESS")
|
||||
|
||||
|
||||
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})
|
||||
|
||||
instance.query("GRANT CREATE ON tbl TO robin")
|
||||
instance.query("CREATE TABLE tbl(a Int32) ENGINE=Log", user="robin")
|
||||
instance.query("DROP TABLE tbl")
|
||||
|
||||
|
||||
def test_allow_introspection():
|
||||
assert "Not enough privileges" in instance.query_and_get_error("SELECT demangle('a')", user="robin")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user