-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Enhancement] Support is_role_in_session function (#32984)
Signed-off-by: HangyuanLiu <[email protected]>
- Loading branch information
1 parent
a7dec81
commit b6954d3
Showing
8 changed files
with
230 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
-- name: test_is_role_in_session | ||
drop role if exists r1; | ||
-- result: | ||
-- !result | ||
create role r1; | ||
-- result: | ||
-- !result | ||
drop role if exists r2; | ||
-- result: | ||
-- !result | ||
create role r2; | ||
-- result: | ||
-- !result | ||
drop role if exists r3; | ||
-- result: | ||
-- !result | ||
create role r3; | ||
-- result: | ||
-- !result | ||
drop user if exists u1; | ||
-- result: | ||
-- !result | ||
create user u1; | ||
-- result: | ||
-- !result | ||
grant impersonate on user root to u1; | ||
-- result: | ||
-- !result | ||
grant r3 to role r2; | ||
-- result: | ||
-- !result | ||
grant r2 to role r1; | ||
-- result: | ||
-- !result | ||
grant r1 to u1; | ||
-- result: | ||
-- !result | ||
execute as u1 with no revert; | ||
-- result: | ||
-- !result | ||
select is_role_in_session("r1"); | ||
-- result: | ||
0 | ||
-- !result | ||
select is_role_in_session("r2"); | ||
-- result: | ||
0 | ||
-- !result | ||
select is_role_in_session("r3"); | ||
-- result: | ||
0 | ||
-- !result | ||
set role all; | ||
-- result: | ||
-- !result | ||
select is_role_in_session("r1"); | ||
-- result: | ||
1 | ||
-- !result | ||
select is_role_in_session("r2"); | ||
-- result: | ||
1 | ||
-- !result | ||
select is_role_in_session("r3"); | ||
-- result: | ||
1 | ||
-- !result | ||
execute as root with no revert; | ||
-- result: | ||
-- !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,25 @@ | ||
-- name: test_is_role_in_session | ||
drop role if exists r1; | ||
create role r1; | ||
drop role if exists r2; | ||
create role r2; | ||
drop role if exists r3; | ||
create role r3; | ||
drop user if exists u1; | ||
create user u1; | ||
grant impersonate on user root to u1; | ||
|
||
grant r3 to role r2; | ||
grant r2 to role r1; | ||
grant r1 to u1; | ||
|
||
execute as u1 with no revert; | ||
select is_role_in_session("r1"); | ||
select is_role_in_session("r2"); | ||
select is_role_in_session("r3"); | ||
set role all; | ||
select is_role_in_session("r1"); | ||
select is_role_in_session("r2"); | ||
select is_role_in_session("r3"); | ||
|
||
execute as root with no revert; |