Skip to content

Commit c395a44

Browse files
pufitnikitamikhaylov
authored andcommitted
enable_user_name_access_type must not affect DEFINER access type
1 parent 76b851b commit c395a44

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Access/Common/AccessRightsElement.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ void AccessRightsElement::formatONClause(WriteBuffer & buffer, bool hilite) cons
156156
/// If `enable_user_name_access_type` is set to false, we will dump `GRANT CREATE USER ON *` as `GRANT CREATE USER ON *.*`.
157157
/// This will allow us to run old replicas in the same cluster.
158158
if (access_flags.getParameterType() == AccessFlags::USER_NAME
159+
&& access_flags != AccessType::SET_DEFINER
159160
&& !is_enabled_user_name_access_type)
160161
{
161162
if (!anyParameter())

tests/integration/test_enable_user_name_access_type/test.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ def test_startup_scripts():
1717
cluster.start()
1818
node.query("CREATE USER foobar")
1919
node.query("GRANT CREATE USER ON * TO foobar")
20+
node.query("GRANT SET DEFINER ON * TO foobar")
2021
assert (
21-
node.query(
22+
sorted(node.query(
2223
"SHOW GRANTS FOR foobar"
23-
)
24-
== "GRANT CREATE USER ON *.* TO foobar\n"
24+
).split('\n'))
25+
== ["GRANT CREATE USER ON *.* TO foobar", "GRANT SET DEFINER ON * TO foobar"]
2526
)
2627
node.query("DROP USER foobar")
2728
finally:

0 commit comments

Comments
 (0)