-
Notifications
You must be signed in to change notification settings - Fork 761
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: SHOW GRANTS should not display drop on table/database (#14931)
feat: show grants not display droped table/database
- Loading branch information
Showing
26 changed files
with
232 additions
and
41 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
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
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
23 changes: 23 additions & 0 deletions
23
tests/suites/0_stateless/18_rbac/18_0004_show_grants_with_dropped.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,23 @@ | ||
GRANT OWNERSHIP ON 'default'.'c_r'.* TO ROLE `role3` | ||
GRANT INSERT ON 'default'.'c_r1'.* TO ROLE `role3` | ||
GRANT SELECT,INSERT ON 'default'.'c_r2'.* TO ROLE `role3` | ||
GRANT SELECT,OWNERSHIP ON 'default'.'c_r'.'t' TO ROLE `role3` | ||
GRANT UPDATE,DELETE ON 'default'.'c_r1'.'t1' TO ROLE `role3` | ||
GRANT UPDATE,DELETE ON 'default'.'c_r2'.'t2' TO ROLE `role3` | ||
=== drop database c_r , c_r2 === | ||
GRANT INSERT ON 'default'.'c_r1'.* TO ROLE `role3` | ||
GRANT UPDATE,DELETE ON 'default'.'c_r1'.'t1' TO ROLE `role3` | ||
=== undrop database c_r2 === | ||
GRANT INSERT ON 'default'.'c_r1'.* TO ROLE `role3` | ||
GRANT SELECT,INSERT ON 'default'.'c_r2'.* TO ROLE `role3` | ||
GRANT UPDATE,DELETE ON 'default'.'c_r1'.'t1' TO ROLE `role3` | ||
GRANT UPDATE,DELETE ON 'default'.'c_r2'.'t2' TO ROLE `role3` | ||
=== undrop database c_r, contain table c_r.t's ownership === | ||
GRANT INSERT ON 'default'.'c_r1'.* TO ROLE `role3` | ||
GRANT SELECT,INSERT ON 'default'.'c_r2'.* TO ROLE `role3` | ||
GRANT SELECT,OWNERSHIP ON 'default'.'c_r'.'t' TO ROLE `role3` | ||
GRANT UPDATE,DELETE ON 'default'.'c_r1'.'t1' TO ROLE `role3` | ||
GRANT UPDATE,DELETE ON 'default'.'c_r2'.'t2' TO ROLE `role3` | ||
=== drop database c_r, c_r2, re-create c_r, c_r2 === | ||
GRANT INSERT ON 'default'.'c_r1'.* TO ROLE `role3` | ||
GRANT UPDATE,DELETE ON 'default'.'c_r1'.'t1' TO ROLE `role3` |
53 changes: 53 additions & 0 deletions
53
tests/suites/0_stateless/18_rbac/18_0004_show_grants_with_dropped.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,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
. "$CURDIR"/../../../shell_env.sh | ||
|
||
|
||
echo "drop role if exists role3;" | $BENDSQL_CLIENT_CONNECT | ||
echo "drop database if exists c_r;" | $BENDSQL_CLIENT_CONNECT | ||
echo "drop database if exists c_r1;" | $BENDSQL_CLIENT_CONNECT | ||
echo "drop database if exists c_r2;" | $BENDSQL_CLIENT_CONNECT | ||
|
||
echo "create role role3;" | $BENDSQL_CLIENT_CONNECT | ||
echo "create database c_r1" | $BENDSQL_CLIENT_CONNECT | ||
echo "create table c_r1.t1(id int)" | $BENDSQL_CLIENT_CONNECT | ||
echo "create database c_r2" | $BENDSQL_CLIENT_CONNECT | ||
echo "create table c_r2.t2(id int)" | $BENDSQL_CLIENT_CONNECT | ||
echo "create database c_r;" | $BENDSQL_CLIENT_CONNECT | ||
echo "create table c_r.t(id int);" | $BENDSQL_CLIENT_CONNECT | ||
echo "grant ownership on c_r.* to role role3;" | $BENDSQL_CLIENT_CONNECT | ||
echo "grant ownership on c_r.t to role role3;" | $BENDSQL_CLIENT_CONNECT | ||
|
||
echo "grant select on c_r.t to role role3;" | $BENDSQL_CLIENT_CONNECT | ||
echo "grant insert on c_r1.* to role role3;" | $BENDSQL_CLIENT_CONNECT | ||
echo "grant update, delete on c_r1.t1 to role role3;" | $BENDSQL_CLIENT_CONNECT | ||
echo "grant select, insert on c_r2.* to role role3;" | $BENDSQL_CLIENT_CONNECT | ||
echo "grant update, delete on c_r2.t2 to role role3;" | $BENDSQL_CLIENT_CONNECT | ||
|
||
echo "show grants for role role3;" | $BENDSQL_CLIENT_CONNECT | ||
echo "drop database c_r;" | $BENDSQL_CLIENT_CONNECT | ||
echo "drop database c_r2;" | $BENDSQL_CLIENT_CONNECT | ||
|
||
echo "=== drop database c_r , c_r2 ===" | ||
echo "show grants for role role3;" | $BENDSQL_CLIENT_CONNECT | ||
|
||
echo "=== undrop database c_r2 ===" | ||
echo "undrop database c_r2" | $BENDSQL_CLIENT_CONNECT | ||
echo "show grants for role role3;" | $BENDSQL_CLIENT_CONNECT | ||
|
||
echo "=== undrop database c_r, contain table c_r.t's ownership ===" | ||
echo "undrop database c_r" | $BENDSQL_CLIENT_CONNECT | ||
echo "show grants for role role3;" | $BENDSQL_CLIENT_CONNECT | ||
|
||
echo "=== drop database c_r, c_r2, re-create c_r, c_r2 ===" | ||
echo "drop database c_r" | $BENDSQL_CLIENT_CONNECT | ||
echo "drop database c_r2" | $BENDSQL_CLIENT_CONNECT | ||
echo "create database c_r" | $BENDSQL_CLIENT_CONNECT | ||
echo "create database c_r2" | $BENDSQL_CLIENT_CONNECT | ||
echo "show grants for role role3;" | $BENDSQL_CLIENT_CONNECT | ||
|
||
echo "drop role if exists role3;" | $BENDSQL_CLIENT_CONNECT | ||
echo "drop database if exists c_r;" | $BENDSQL_CLIENT_CONNECT | ||
echo "drop database if exists c_r1;" | $BENDSQL_CLIENT_CONNECT | ||
echo "drop database if exists c_r2;" | $BENDSQL_CLIENT_CONNECT |
Oops, something went wrong.