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

Impossible to retrieve all users from account manager due to hardcoded page number #550

Open
dlebreuilly-loreal opened this issue Jan 4, 2024 · 0 comments

Comments

@dlebreuilly-loreal
Copy link

Hi,
I'm one of the administrators of an org with a large amount of users.
I'm currently in the process of extracting all of those users, crunching stats and hopefully making some cleanup, so I reached out to sfcc-ci since I'm using node.js to script.
However, whatever the max count I passed, I didn't manage to get all of my users, hitting a max cap of 4000. (yes, I have more than that. Hence the need to clean that up)

So, i briefly digged into the code and found this line, which is used in the case you're not passing either org or role to filter with (attempting to list all the users you can manage, including the invited ones):

var endpoint = '/users?page=0&size=' + size;
https://github.com/SalesforceCommerceCloud/sfcc-ci/blob/7eacb62016aa14e3ab1c0871370d2be5c0797815/lib/user.js#L249C48-L249C48

Looks like the page number is harcoded, assuming that whatever number sent out as the page size will be matched by the API.
However, by hitting the API directly (since I had to do that to complete my task anyway), I confirmed that there is a page size limit of 4000 entries. To fix that, code would need to be a bit more complex than it is, performing several requests and aggregating the users until requested count or end of last page is reached.

Regards,
Damien L.

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