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

Prefered way to use casbin in a web framework with lots of users? #452

Open
akhilmhdh opened this issue Aug 7, 2023 · 2 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@akhilmhdh
Copy link

Hey there,

We were going through casbin for our new permission system, and loved the features it provides. But one thing that has been bothering us is the policies.

So each user in an organization will add their contribution to policies in one way or another, and the policies will keep on growing.

We went through the code and saw that, most of the examples use LoadPolicy which loads up the entire db into into in memory.

Then there was LoadFilteredPolicy which LazyLoad. We wanted to use LoadFilteredPolicy but the major doubt is can we create an enforcer instance per request.

That is

  1. A request comes in -> Using a middleware create a FilteredPolicy enforcer which could be for a domain like org or user
  2. This will be used just that request context.
  3. Repeat for next request. Use caching to save number of db hits

We know the express-authz, and other framework integrations are provided by the amazing casbin team. But all those does loadPolicy. Read other similiar Github Issues but still didn't had proper answer on the filtered part. Sorry if we missed any important thread or documentation.

Same happened inside documentation, policy subset loading did ans this loading feature, but then how would you save to db without loading entire database.

Thank you

@casbin-bot
Copy link
Member

@nodece @Shivansh-yadav13

@casbin-bot casbin-bot added the enhancement New feature or request label Aug 7, 2023
@akhilmhdh
Copy link
Author

Sorry didn't had the discussions enabled for this repo. Else i would have asked it their

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

3 participants