forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct revoke for the partially granted rights. (ClickHouse#61115)
* Correct revoke for the partially granted rights.
- Loading branch information
Showing
5 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
tests/queries/0_stateless/03006_correct_revoke_for_partial_rights.reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2 |
33 changes: 33 additions & 0 deletions
33
tests/queries/0_stateless/03006_correct_revoke_for_partial_rights.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
# shellcheck source=../shell_config.sh | ||
. "$CURDIR"/../shell_config.sh | ||
|
||
db=${CLICKHOUSE_DATABASE} | ||
user1="user1_03006_$db_$RANDOM" | ||
user2="user2_03006_$db_$RANDOM" | ||
|
||
${CLICKHOUSE_CLIENT} --multiquery <<EOF | ||
DROP DATABASE IF EXISTS $db; | ||
CREATE DATABASE $db; | ||
CREATE USER $user1, $user2; | ||
GRANT SELECT ON *.* TO $user2 WITH GRANT OPTION; | ||
REVOKE SELECT ON system.* FROM $user2; | ||
EOF | ||
|
||
${CLICKHOUSE_CLIENT} --user $user2 --query "GRANT CURRENT GRANTS ON *.* TO $user1" | ||
${CLICKHOUSE_CLIENT} --user $user2 --query "REVOKE ALL ON *.* FROM $user1" | ||
${CLICKHOUSE_CLIENT} --query "SHOW GRANTS FOR $user1" | ||
|
||
${CLICKHOUSE_CLIENT} --user $user2 --query "GRANT CURRENT GRANTS ON *.* TO $user1" | ||
${CLICKHOUSE_CLIENT} --query "REVOKE ALL ON $db.* FROM $user1" | ||
${CLICKHOUSE_CLIENT} --user $user2 --query "REVOKE ALL ON *.* FROM $user1" | ||
${CLICKHOUSE_CLIENT} --query "SHOW GRANTS FOR $user1" | ||
|
||
${CLICKHOUSE_CLIENT} --user $user2 --query "GRANT CURRENT GRANTS ON *.* TO $user1" | ||
${CLICKHOUSE_CLIENT} --query "REVOKE ALL ON $db.* FROM $user2" | ||
${CLICKHOUSE_CLIENT} --user $user2 --query "REVOKE ALL ON *.* FROM $user1" 2>&1 | grep -c "ACCESS_DENIED" | ||
|
||
${CLICKHOUSE_CLIENT} --query "DROP DATABASE IF EXISTS $db" |