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

refactor: expanded product admin permissions #5428

Merged

Conversation

kieckhafer
Copy link
Member

@kieckhafer kieckhafer commented Aug 7, 2019

Impact: major
Type: feature

Issue

We currently use the createProduct as a catch-all for any product related admin action. All users should not have permission to do all things with a product.

Solution

Granulate permissions so that different users can perform different tasks, and not have all permissions on product admin.

  • To keep backwards compatibility, we are keeping the createProduct permission as is, so any existing user groups with createRefund permission are not affected.
  • We've added a new product/admin permission in all places where createProduct is used. This will provide forward capability to use this permission as a catch-all / super-admin with a better descriptive name.
  • We've also added five new permissions that are added in addition to product/admin in places where deemed appropriate: product/archive, product/clone, product/create, product/publish, and product/update.

Thoughts for discussion

  • product/clone and product/create probably could be merged, if that's seen as a better fit, however I can imagine instances where a user should only be allowed to clone a variant, not create a whole new product.
  • We could potentially remove createProduct and swap it for product/admin, instead of just adding product/admin in addition, but this would be a breaking change, and should probably be better addressed in an entire permissions overhaul, rather than this.

Breaking changes

None. We keep our existing createProduct permission as is. All new permissions are In addition to createProduct.

Testing

  1. Invite a new user to a non-full-admin group (ex. shop manager)
  2. Turn off the createProduct permission (called Add product in our UI), which is the main products permission for the entire app

Accounts

  1. Turn on Product Admin permission in the new section
  2. See that you can perform all Product related updates / deletions / etc, nothing should be different
  3. Turn off Product Admin
  4. Turn on all permissions, except, Archive Product. See that the archive button is missing from the actions dropdown
  5. Turn of Clone Product, and see that Duplicate is missing from the dropdown
  6. Turn off Create product and see that + is missing from the variant / option list

Reaction

Note: You must have either product/admin, product/update, or createProduct permission in order to even see a product page. If none of those are active, you'll see a blank page / error. This is consistent with the current app.

@kieckhafer kieckhafer changed the title [WIP] expanded order permissions [WIP] expanded product admin permissions Aug 7, 2019
@kieckhafer kieckhafer changed the title [WIP] expanded product admin permissions refactor: expanded product admin permissions Aug 7, 2019
@kieckhafer kieckhafer marked this pull request as ready for review August 7, 2019 05:16
Signed-off-by: Erik Kieckhafer <[email protected]>
Signed-off-by: Erik Kieckhafer <[email protected]>
@aldeed
Copy link
Contributor

aldeed commented Aug 8, 2019

Didn't test, but code 👍

@kieckhafer
Copy link
Member Author

@aldeed thanks! @bt3gl could you please do the UI testing portion of this?

@von-steinkirch
Copy link
Contributor

@kieckhafer On it

@machikoyasuda
Copy link
Contributor

I'm trying to test this PR locally cos Mia was having trouble.

I got up to the part where I made a new Store Manager w/ the updated Product Admin permissions... and then I tried to log out, by clicking the corner menu button and Log Out. But it immediately logged me back in. I tried opening the site in Safari, Firefox, Chrome, even Vivaldi, but same deal. I then manually deleted all my Session cookies. Now I'm stuck in this Zombie mode, where I cannot access the login / log out buttons at all.

Screen Shot 2019-08-09 at 5 54 03 PM

Sooo @kieckhafer What's the trick to logging into several different Admin w/ different Users? Use different browsers? Use different browsers, in Incognito mode? Manually delete session cookies?

@von-steinkirch
Copy link
Contributor

von-steinkirch commented Aug 10, 2019

As @machikoyasuda mention, I was never able to fully test this because any time I try to turn anything on/off, I get the error below. Independent of selecting "Shop Manager" or no. No errors appear on logs, so I have no idea how to debug this.
Screen Shot 2019-08-09 at 8 05 53 PM

@machikoyasuda
Copy link
Contributor

I tested the UI on this and it works for me 👍

@kieckhafer kieckhafer merged commit 9cba900 into develop Aug 12, 2019
@kieckhafer kieckhafer deleted the fix/refactor-kieckhafer-permissionsAroundProductsGroups branch August 12, 2019 20:49
@kieckhafer kieckhafer mentioned this pull request Aug 28, 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