reactioncommerce / reaction

Mailchimp Open Commerce is an API-first, headless commerce platform built using Node.js, React, GraphQL. Deployed via Docker and Kubernetes.
https://mailchimp.com/developer/open-commerce/
GNU General Public License v3.0
12.34k stars 2.17k forks source link

Logged in should always land me on my own shop #3184

Closed cindyfirestone closed 6 years ago

cindyfirestone commented 6 years ago

Expected behavior

As a store operator with a shop on a marketplace, when I log into my shop it should land me on the shop associated with the account I logged in with.

Actual behavior

When I login, it lands me on the main marketplace, and I need to go into the dropdown in the upper left hand corner and select my shop.

Steps to reproduce the behavior

  1. Log into your shop
  2. Land on main marketplace
  3. Go to upper left hand corner and select your store

home

speedingdeer commented 6 years ago

same here

kieckhafer commented 6 years ago

@spencern

https://github.com/reactioncommerce/reaction/blame/master/client/modules/core/main.js#L327

What are your thoughts on updating hasShopSwitcherAccess to only show the switcher if you are the overall Marketplace admin (Primary shop admin) instead of a user with dashboard access to any shop?

Something like this:

hasShopSwitcherAccess() {
    return hasAdminAccess(getPrimaryShopId());
  },

hasShopSwitcherAccess() is not used anywhere in the app, it's declared here and that's it.

spencern commented 6 years ago

@kieckhafer we may need to show this shopSwitcher if you have admin access on more than one shop. E.g. writing Reaction wrapper around Roles.getGroupsForUsers("admin") returns > 1 shopId.

Additionally, once we remove this, it becomes super important to verify that a user always has their activeShop set to the shop they have admin access for on login, and that it's unset on logout (in case of public computer, multi-user computer, etc)

kieckhafer commented 6 years ago

Merged in #3375