forked from databendlabs/databend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rbac): treat the empty ownership as owned by ACCOUNT_ADMIN inste…
…ad of PUBLIC (databendlabs#14112) * default as account_admin * fix cargo check * allow list in system tables * tune comments * remove verify_ownership parameter in validate_access_db and _table * fix typo * fix lint * add test for rewritten * add stateless tests * fix stateless error * fix set_role * add result file * rename validate_ownership to has_ownership * fix typo
- Loading branch information
1 parent
a53315b
commit 3fdf353
Showing
8 changed files
with
139 additions
and
140 deletions.
There are no files selected for viewing
197 changes: 85 additions & 112 deletions
197
src/query/service/src/interpreters/access/privilege_access.rs
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
3 changes: 3 additions & 0 deletions
3
tests/suites/0_stateless/18_rbac/20_0016_rewrite_statements.result
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,3 @@ | ||
-- reset users | ||
-- prepare user and tables for tests | ||
-- ensure the statements not break with PUBLIC role |
23 changes: 23 additions & 0 deletions
23
tests/suites/0_stateless/18_rbac/20_0016_rewrite_statements.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,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
. "$CURDIR"/../../../shell_env.sh | ||
|
||
export TEST_USER_PASSWORD="password" | ||
export TEST_USER_CONNECT="bendsql --user=testuser1 --password=password --host=${QUERY_MYSQL_HANDLER_HOST} --port ${QUERY_HTTP_HANDLER_PORT}" | ||
|
||
echo '-- reset users' | ||
echo "DROP USER IF EXISTS 'testuser1'" | $BENDSQL_CLIENT_CONNECT | ||
|
||
echo '-- prepare user and tables for tests' | ||
echo "CREATE USER 'testuser1' IDENTIFIED BY '$TEST_USER_PASSWORD'" | $BENDSQL_CLIENT_CONNECT | ||
echo "CREATE TABLE IF NOT EXISTS t20_0016_table1(c int not null)" | $BENDSQL_CLIENT_CONNECT | ||
echo "GRANT SELECT ON default.t20_0016_table1 TO testuser1" | $BENDSQL_CLIENT_CONNECT | ||
|
||
echo '-- ensure the statements not break with PUBLIC role' | ||
echo "SHOW TABLES;" | $TEST_USER_CONNECT > /dev/null | ||
echo "SHOW DATABASES;" | $TEST_USER_CONNECT > /dev/null | ||
echo "SHOW USERS;" | $TEST_USER_CONNECT > /dev/null | ||
echo "SHOW ROLES;" | $TEST_USER_CONNECT > /dev/null | ||
echo "SHOW STAGES;" | $TEST_USER_CONNECT > /dev/null | ||
echo "SHOW PROCESSLIST;" | $TEST_USER_CONNECT > /dev/null |