How to use Casbin for paginated search

38 Views Asked by At

We are currently using casbin in our Java microservices architecture for business authorization. Most of the scenarios are working fine and are afficient, but we have one scenarios that we don't like we implemented, it is about a paginated search where we integrated casbin. We should display a paginated contend based on the user permission. The current way we implemented this is by listing everithing from DB and filtering them using casbin and stop when we reach the content of the page we want:

e.g.

  • if we want first page with 20 entries, we stop when we have found first 20 entries that the user has access to;
  • if we want second page with 20 entries, we stop wen we have found 40 entries that the user has access to but we take only the latest 20 entries.

Righ now we are experimenting using casbin:jdbc-adapter and we are storing the policies in the DB and we hoped that casbin provides a way of joining casbin table (casbin_rule) with our business table and be abble to fetch directly the content of the page we want.

Do you know there is a way to perform casbin check integrating our business table with casbin one's?

I was trying to join my business table with the casbin one's and do the select but in the casbin table I'm storing many policies that are having different structures and is hard to perfrom the sql join from my table to casbin's.

0

There are 0 best solutions below