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

fix saving inactive admin user, when record doesn't exist in oauth_token table #22118

Closed
wants to merge 1 commit into from

Conversation

dxx004
Copy link

@dxx004 dxx004 commented Apr 2, 2019

Description (*)

PR handles thrown exception during saving inactive admin user or saving admin rule with inactive admin user assigned, when record (for the admin user) doesn't exist in oauth_token table.

Fixed Issues (if relevant)

  1. ...
  2. ...

Manual testing scenarios (*)

  1. in backend - Navigate to System -> Permissions -> All Users
  2. Add new inactive user, don't assign any role
  3. Save
  4. Error message "This user has no tokens." is shown, user is not saved

the same error is shown, when trying to assign inactive admin user to admin role and save.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@dxx004 dxx004 requested a review from odubovyk April 2, 2019 14:57
@m2-assistant
Copy link

m2-assistant bot commented Apr 2, 2019

Hi @dxx004. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Apr 2, 2019

CLA assistant check
All committers have signed the CLA.

@orlangur orlangur self-assigned this Apr 2, 2019
Copy link
Contributor

@orlangur orlangur left a comment

Choose a reason for hiding this comment

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

@dxx004 please report an issue so that it can be verified first.

try {
$this->adminTokenService->revokeAdminAccessToken($object->getId());
} catch (LocalizedException $e) {
//token for admin use doesn't exist in oauth_token table, no action
Copy link
Contributor

Choose a reason for hiding this comment

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

This exception looks like intentionally not caught before. What are other possibilities of fix?

@dxx004
Copy link
Author

dxx004 commented Apr 4, 2019

@orlangur , found out it's duplicate issue of this PR #20772 , so closing this one. Thx

@dxx004 dxx004 closed this Apr 4, 2019
@m2-assistant
Copy link

m2-assistant bot commented Apr 4, 2019

Hi @dxx004, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@orlangur
Copy link
Contributor

orlangur commented Apr 4, 2019

@dxx004 oh, thanks, that's why it is a good idea to search for existing bug report :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants