Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@trojanh
Copy link
Contributor

@trojanh trojanh commented Oct 10, 2019

Resolves none
Impact: breaking
Type: bugfix

Issue

Creating Navigation Item from Reaction Admin UI breaks for anyone other than the owner.

Solution

Supplying shopId to userHasPermission fixes the above issue and the non-owner user is able to add the NavigationItem.

Breaking changes

Steps to reproduce:

  1. Login as Shop Manager or someone who has core permission but not as an Owner
  2. Go to Navigation page and try adding a new Navigation Item
  3. You will see the form to add the NavigationItem and after saving the item the NavigationItem doesn't appear in the list.

This works fine for the Owner. The problem was the method was called with a missing parameter for
userHasPermission which also expects roleGroup parameter which is shopId for us.

Testing

  1. Login as Shop Manager or someone who has core permission but not as an Owner
  2. Go to Navigation page and try adding a new Navigation Item
  3. You will see the form to add the NavigationItem and after saving the item the NavigationItem appears on the list.

@trojanh trojanh force-pushed the develop branch 2 times, most recently from a745646 to d513593 Compare October 10, 2019 11:18
@trojanh
Copy link
Contributor Author

trojanh commented Oct 10, 2019

I think navigationTreeById query should also have shopId parameter here

const isAdmin = userHasPermission(["admin", "owner", "create-product"]);

@spencern spencern requested a review from mikemurray October 10, 2019 19:13
Copy link
Member

@mikemurray mikemurray left a comment

Choose a reason for hiding this comment

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

👍 Failing tests look unrelated/happening to a bunch of other open PR's

@trojanh
Copy link
Contributor Author

trojanh commented Oct 11, 2019

Thanks, @mikemurray for reviewing my PR, let me know if I could do anything to fix the failing tests.

@aldeed
Copy link
Contributor

aldeed commented Oct 22, 2019

@trojanh Thank you. Can you merge latest develop into this branch? That should fix the CI tests and allow us to be sure this doesn't break anything, but otherwise the code changes look good.

@aldeed
Copy link
Contributor

aldeed commented Oct 28, 2019

@trojanh Ping. See my comment above.

@trojanh
Copy link
Contributor Author

trojanh commented Oct 29, 2019

Sorry for the delay @aldeed it was Diwali so couldn't revert back, appreciate the reminder though. I have pulled the latest develop branch so it should fix the issue.

@aldeed aldeed merged commit 3c5238d into reactioncommerce:develop Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants