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

executor, privileges: fix privileges check fail for SET DEFAULT ROLE #11201

Merged
merged 11 commits into from
Aug 19, 2019

Conversation

imtbkcat
Copy link

What problem does this PR solve?

fix #11165
SET DEFAULT ROLE should always be avaible for current_user

What is changed and how it works?

Implement setDefaultRoleForCurrentUser.
Remove original privilege check for SET DEFAULT ROLE.
Add new privilege check for SET DEFAULT ROLE.
If is setting default role for current user, just skip check and call setDefaultRoleForCurrentUser.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Side effects

  • Increased code complexity

Related changes

  • Need to cherry-pick to the release branch

@codecov
Copy link

codecov bot commented Jul 11, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@2ea24e0). Click here to learn what that means.
The diff coverage is 69.0476%.

@@             Coverage Diff             @@
##             master     #11201   +/-   ##
===========================================
  Coverage          ?   81.0424%           
===========================================
  Files             ?        423           
  Lines             ?      90022           
  Branches          ?          0           
===========================================
  Hits              ?      72956           
  Misses            ?      11780           
  Partials          ?       5286

@codecov
Copy link

codecov bot commented Jul 11, 2019

Codecov Report

Merging #11201 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #11201   +/-   ##
===========================================
  Coverage   81.9629%   81.9629%           
===========================================
  Files           434        434           
  Lines         95276      95276           
===========================================
  Hits          78091      78091           
  Misses        11744      11744           
  Partials       5441       5441

@imtbkcat
Copy link
Author

/run-all-tests tidb-test=pr/847

@jackysp
Copy link
Member

jackysp commented Jul 15, 2019

PTAL @tiancaiamao @lysu

executor/simple.go Outdated Show resolved Hide resolved
func (e *SimpleExec) releaseSysSession(ctx sessionctx.Context) {
dom := domain.GetDomain(e.ctx)
sysSessionPool := dom.SysSessionPool()
sysSessionPool.Put(ctx.(pools.Resource))
Copy link
Contributor

Choose a reason for hiding this comment

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

sysSessionPool.Put(ctx) should work, and import "github.com/ngaut/pools" is not necessary.

@tiancaiamao
Copy link
Contributor

LGTM @lysu

@tiancaiamao tiancaiamao added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 2, 2019
@imtbkcat
Copy link
Author

imtbkcat commented Aug 2, 2019

/run-all-tests

@imtbkcat
Copy link
Author

imtbkcat commented Aug 2, 2019

/run-all-tests

@imtbkcat
Copy link
Author

imtbkcat commented Aug 2, 2019

/run-unit-test

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

@jackysp jackysp added the status/can-merge Indicates a PR has been approved by a committer. label Aug 19, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Aug 19, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Aug 19, 2019

cherry pick to release-3.0 in PR #11774

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 status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SET DEFAULT ROLE fails privilege check
5 participants