Skip to content

b2b organization does not allow adding users #87

Description

@MarlonPassos-git

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions