Ask HN: How did you solve the pagination in role based access system?
In a system where user can read and interact with entities based on their role, how did you solve the problem of listing all the entities user has access to in a paginated manner?
Generally, this problem is called ACL-Filtering[0][1] and can be done in two ways: a filter for selecting the entities from your database or as a filter after the entities have been returned from the database. Sometimes you might even have to do both.
If you decide to use a specialized database for permissions, similar to SpiceDB[2], there are often specialized APIs for directly listing the entities a subject has access to in various ways.
[0]: https://docs.authzed.com/reference/glossary#acl-filtering
[1] https://blog.openpolicyagent.org/partial-evaluation-162750ea...