mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Add implicit grants with grant option too. (#38017)
This commit is contained in:
parent
a694ba5fc3
commit
241b51c7d4
@ -120,6 +120,7 @@ namespace
|
||||
|
||||
AccessRights res = access;
|
||||
res.modifyFlags(modifier);
|
||||
res.modifyFlagsWithGrantOption(modifier);
|
||||
|
||||
/// Anyone has access to the "system" and "information_schema" database.
|
||||
res.grant(AccessType::SELECT, DatabaseCatalog::SYSTEM_DATABASE);
|
||||
|
@ -342,6 +342,18 @@ def test_implicit_create_view_grant():
|
||||
"CREATE VIEW test.view_1 AS SELECT 1", user="A"
|
||||
)
|
||||
|
||||
# check grant option
|
||||
instance.query("CREATE USER B")
|
||||
expected_error = "Not enough privileges"
|
||||
assert expected_error in instance.query_and_get_error(
|
||||
"GRANT CREATE VIEW ON test.* TO B", user="A"
|
||||
)
|
||||
|
||||
instance.query("GRANT CREATE TABLE ON test.* TO A WITH GRANT OPTION")
|
||||
instance.query("GRANT CREATE VIEW ON test.* TO B", user="A")
|
||||
instance.query("CREATE VIEW test.view_2 AS SELECT 1", user="B")
|
||||
assert instance.query("SELECT * FROM test.view_2") == "1\n"
|
||||
|
||||
|
||||
def test_implicit_create_temporary_table_grant():
|
||||
instance.query("CREATE USER A")
|
||||
|
Loading…
Reference in New Issue
Block a user