privilege, executor: add SET ROLE and CURRENT_ROLE support#9581
Merged
imtbkcat merged 15 commits intopingcap:masterfrom Mar 21, 2019
Merged
privilege, executor: add SET ROLE and CURRENT_ROLE support#9581imtbkcat merged 15 commits intopingcap:masterfrom
SET ROLE and CURRENT_ROLE support#9581imtbkcat merged 15 commits intopingcap:masterfrom
Conversation
jackysp
reviewed
Mar 7, 2019
Contributor
There was a problem hiding this comment.
Move this line to the third party libs part.
jackysp
reviewed
Mar 7, 2019
Contributor
There was a problem hiding this comment.
It is better to add some test cases for this built-in function.
Codecov Report
@@ Coverage Diff @@
## master #9581 +/- ##
================================================
- Coverage 67.1706% 67.1505% -0.0202%
================================================
Files 381 381
Lines 79956 80053 +97
================================================
+ Hits 53707 53756 +49
- Misses 21460 21504 +44
- Partials 4789 4793 +4 |
tiancaiamao
reviewed
Mar 12, 2019
Author
|
/run-all-tests |
Author
|
PTAL @tiancaiamao |
tiancaiamao
reviewed
Mar 18, 2019
Contributor
There was a problem hiding this comment.
make(map[string]*auth.RoleIdentity, len(s.RoleList))
Contributor
There was a problem hiding this comment.
Why protobuf is changed here?
Contributor
There was a problem hiding this comment.
It's better to use roleList map[string]struct{} here
roleList map[string]struct{}
roleList["xx"] = struct{}{}
if _, ok := roleList["xx"] {
...
}
Contributor
|
LGTM |
Author
|
PTAL @jackysp |
Author
|
/run-all-tests |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
support active role and
SET ROLE,CURRENT_ROLEfunction.What is changed and how it works?
Create an graph data structure to find relationship between role and user quickly, which is always update as other privilege tables. It will load
mysql.role_edgestable, and convert relationship to an graph.When we need to active some roles for current session, we need to check whether these roles has been granted for current user.
RoleGraphcan finish this task quickly.SET ROLEis just for set active role for current session, more detail: https://dev.mysql.com/doc/refman/8.0/en/set-role.htmlBecause
set default roleis not support yet. some gramma will be added soon.Check List
Tests
Code changes
Side effects