vendure-ecommerce / vendure

The commerce platform with customization in its DNA.
https://www.vendure.io
MIT License
5.39k stars 943 forks source link

RoleService findAll list display/pagination is broken due to post query filtering #2890

Open mschipperheyn opened 2 weeks ago

mschipperheyn commented 2 weeks ago

Describe the bug The RoleService findAll query does a post result filter that filters the available roles based on the ability of the current user to see them.

To Reproduce Steps to reproduce the behavior:

  1. Create a user and some roles.
  2. Assign only those roles to the user
  3. Login as the user
  4. use take: 1 and sort by createdAt Asc
  5. The roles you are supposed to see are not on page 1, which is empty

Expected behavior There are two corrections possible:

  1. the filtering should happen at the query level instead of at the post query level
  2. keep the post query filtering but reduce the totalItems by the amount of roles that are "hidden" (this is a bad workaround bc it will still lead to empty screens even though it partly fixes pagination. Solution 1 is the only viable one. )

Environment (please complete the following information):

Additional context Not using the Vendure admin-ui