-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement] Support is_role_in_session function #32984
Conversation
fe/fe-core/src/main/java/com/starrocks/sql/analyzer/ExpressionAnalyzer.java
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rewrite/ScalarOperatorFunctions.java
Show resolved
Hide resolved
f847a0d
to
ebe85a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments
@ConstantFunction(name = "is_role_in_session", argTypes = {VARCHAR}, returnType = BOOLEAN) | ||
public static ConstantOperator isRoleInSession(ConstantOperator role) { | ||
AuthorizationMgr manager = GlobalStateMgr.getCurrentState().getAuthorizationMgr(); | ||
List<String> roleName = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
roleName -> roleNames, besides using hash set is better i think.
@@ -1326,5 +1331,34 @@ public static ConstantOperator urlExtractParameter(ConstantOperator url, Constan | |||
} | |||
return ConstantOperator.createNull(Type.VARCHAR); | |||
} | |||
|
|||
private static void getRecursiveRole(AuthorizationMgr manager, List<String> roleName, Long roleId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty much like protected void getAllPredecessorsInner(long roleId, Set<Long> resultSet) throws PrivilegeException
, how about renaming it to getAllPredecessorRoleNames()
and put it in AuthorizationMgr
, it maybe useful in other situations.
Signed-off-by: HangyuanLiu <[email protected]>
ebe85a8
to
fd72a13
Compare
Kudos, SonarCloud Quality Gate passed! |
[FE Incremental Coverage Report]😍 pass : 18 / 18 (100.00%) file detail
|
[BE Incremental Coverage Report]😍 pass : 0 / 0 (0%) |
@Mergifyio backport branch-3.2 |
@Mergifyio backport branch-3.1 |
✅ Backports have been created
|
✅ Backports have been created
|
Signed-off-by: HangyuanLiu <[email protected]> (cherry picked from commit b6954d3) # Conflicts: # fe/fe-core/src/main/java/com/starrocks/privilege/AuthorizationMgr.java # fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rewrite/ScalarOperatorFunctions.java
Signed-off-by: HangyuanLiu <[email protected]> (cherry picked from commit b6954d3) # Conflicts: # fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rewrite/ScalarOperatorFunctions.java
Signed-off-by: HangyuanLiu <[email protected]> (cherry picked from commit b6954d3) Signed-off-by: HangyuanLiu <[email protected]> # Conflicts: # fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rewrite/ScalarOperatorFunctions.java
Signed-off-by: HangyuanLiu <[email protected]> (cherry picked from commit b6954d3) Signed-off-by: HangyuanLiu <[email protected]> # Conflicts: # fe/fe-core/src/main/java/com/starrocks/privilege/AuthorizationMgr.java # fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rewrite/ScalarOperatorFunctions.java
Signed-off-by: HangyuanLiu <[email protected]> (cherry picked from commit b6954d3) Signed-off-by: HangyuanLiu <[email protected]> # Conflicts: # fe/fe-core/src/main/java/com/starrocks/privilege/AuthorizationMgr.java # fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rewrite/ScalarOperatorFunctions.java
Signed-off-by: HangyuanLiu <[email protected]> (cherry picked from commit b6954d3) Signed-off-by: HangyuanLiu <[email protected]> # Conflicts: # fe/fe-core/src/main/java/com/starrocks/privilege/AuthorizationMgr.java # fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rewrite/ScalarOperatorFunctions.java
Signed-off-by: HangyuanLiu <[email protected]> (cherry picked from commit b6954d3) Signed-off-by: HangyuanLiu <[email protected]> # Conflicts: # fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rewrite/ScalarOperatorFunctions.java
Signed-off-by: HangyuanLiu <[email protected]> (cherry picked from commit b6954d3) Signed-off-by: HangyuanLiu <[email protected]> # Conflicts: # fe/fe-core/src/main/java/com/starrocks/privilege/AuthorizationMgr.java # fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rewrite/ScalarOperatorFunctions.java
Fixes #issue
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: