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

b2b organization does not allow adding users #87

Open
MarlonPassos-git opened this issue Dec 6, 2022 · 1 comment
Open

b2b organization does not allow adding users #87

MarlonPassos-git opened this issue Dec 6, 2022 · 1 comment

Comments

@MarlonPassos-git
Copy link
Contributor

Describe the bug
when we change the current store organization with the mutation setCurrentOrganization we don't update the permissions.

To Reproduce

  1. Acess https://alliedempresas.myvtex.com/cadastro-revendedor and create an account.
  2. Wait for someone internal to approve your account (anything, let me know and I'll pass an approved account for you to test)
  3. Access my account
  4. Try to add a new user

Expected behavior
It should open the popup to add new users in the organization

Screenshots
https://imgur.com/gcpw96E

Additional context
How the flow of the store is working:

We have 2 main types of users, one that we call resellers and the other that we think of as consumers, both have organizations. However, every time an internal form is filled out, we create an organization for that reseller user, and associate him with his organization with the role “store-admin”. Then we take that reseller user's email and associate it with other consumer organizations as "customer-buyer”.

Where, yes, “organization-admin” is configured to be able to add new users.

https://prnt.sc/5yvdHfgDrCgZ

In this, every time this reseller accesses my account, we create a custom component that simply takes information from this email user and takes organizationid and
costCenterId of your Admin reseller and we use it in mutation
setCurrentOrganization to make it active in that current organization.

https://prnt.sc/eGP1d2xrK18Z

This works great, even the top popup updates to the correct arrangement.

https://prnt.sc/jqwzmyYcmCz3

Looking at the code, we think that it might be a problem that when we update the current organization it does not update the permissions, because when we look at the permissions, it continues with a permission that is not from the organization we set.

https://prnt.sc/2rf7yNGCu49u

I don't know if it makes sense, but if in this request that is made to get the data, instead of using getUserByEmail by getActiveUserByEmail, you could get the correct information:

https://prnt.sc/vJElKNoIsj5R

@MarlonPassos-git
Copy link
Contributor Author

MarlonPassos-git commented Dec 6, 2022

I found a pr who is apparently seeing this problem,

vtex-apps/storefront-permissions#75

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

No branches or pull requests

1 participant