Skip to content
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

plan, privilege: add role support for SHOW GRANT #10016

Merged
merged 10 commits into from
Apr 21, 2019

Conversation

imtbkcat
Copy link

@imtbkcat imtbkcat commented Apr 3, 2019

What problem does this PR solve?

  1. Support display roles for certain user in SHOW GRANT.
  2. Support display privileges brought by roles for certain user in SHOW GRANT USING roles

What is changed and how it works?

  1. Add Roles field for ShowStmt, ShowExec.
  2. When executing SHOW GRANT, reading roles for current user from roleGraph.
  3. When searching privilege tables like TablesPriv and DbPriv, not only matching record with current user, but also with roles in Roles field.

Some comment change was caused by goword check before commit.
It will block the commit if I don't chenge these comment.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change

Side effects

  • Increased code complexity

@imtbkcat
Copy link
Author

imtbkcat commented Apr 4, 2019

parser pr: pingcap/parser#272

@imtbkcat
Copy link
Author

imtbkcat commented Apr 4, 2019

/run-all-tests

privilege/privileges/cache.go Show resolved Hide resolved
privilege/privileges/cache.go Show resolved Hide resolved
privilege/privileges/privileges.go Outdated Show resolved Hide resolved
privilege/privileges/privileges.go Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Apr 12, 2019

Codecov Report

Merging #10016 into master will increase coverage by 0.0152%.
The diff coverage is 92.2222%.

@@               Coverage Diff                @@
##             master     #10016        +/-   ##
================================================
+ Coverage   77.9584%   77.9736%   +0.0152%     
================================================
  Files           407        407                
  Lines         83075      83146        +71     
================================================
+ Hits          64764      64832        +68     
  Misses        13516      13516                
- Partials       4795       4798         +3

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
PTAL @tiancaiamao

@tiancaiamao
Copy link
Contributor

LGTM
Please resolve conflicts @imtbkcat

@tiancaiamao tiancaiamao added the status/LGT2 Indicates that a PR has LGTM 2. label Apr 18, 2019
@imtbkcat imtbkcat force-pushed the showgrant branch 2 times, most recently from 20f74c9 to 41483ca Compare April 18, 2019 07:29
@imtbkcat
Copy link
Author

/run-all-tests

@imtbkcat
Copy link
Author

PTAL @tiancaiamao

@tiancaiamao
Copy link
Contributor

/run-code_coverage

@zhouqiang-cl
Copy link
Contributor

/rebuild

@imtbkcat imtbkcat merged commit 7cc7323 into pingcap:master Apr 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/privilege sig/execution SIG execution sig/planner SIG: Planner status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants