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

"accessible by" feature for ORM integrations #195

Closed
aguynamedben opened this issue Jan 10, 2023 · 4 comments · Fixed by #210
Closed

"accessible by" feature for ORM integrations #195

aguynamedben opened this issue Jan 10, 2023 · 4 comments · Fixed by #210

Comments

@aguynamedben
Copy link

I've used authorization frameworks that have such tight integration with ORMs that you can write controllers like this:

# get posts, but only the ones allowed for Ben!
def get_posts_for_ben
  ben = User.find_by(email: "ben@email.com")
  ability = Ability.for_user(ben)
  @posts = Post.accessible_by(ability)

There are a few authorization libraries I know of that have this capability:

This Authorization framework + ORM integration increases safety and simplifies development. A new engineer can join a project, write business logic, chain .accessible_by, and respect for the ACL is built into the queries at a low-level.

Do you know of any ORM integrations with casbin that provide this? (in any language) I'm looking at casbin-gorm and other adapters, but don't see this level of ORM integration. Do you know of any adapters or other libraries have this as a goal?

Thank you!

@casbin-bot
Copy link
Member

@tangyang9464 @JalinWang

@jeremycare
Copy link

@aguynamedben, We are also facing the same problem with Casbin vs CASL.

Screenshot 2023-01-19 at 14 03 30

I don't see a proper way to do number 4 with Casbin, really I wasn't able to find anything in the documentation that talks about such things..

Were you able to find something?

@casbin casbin deleted a comment from AbhinayPoloju Feb 19, 2023
@hsluoyz hsluoyz transferred this issue from casbin/casbin Feb 19, 2023
@casbin-bot
Copy link
Member

@hsluoyz hsluoyz removed the question label Feb 19, 2023
@hsluoyz
Copy link
Member

hsluoyz commented Feb 19, 2023

We can implement GetAllowedRecordsForUser() first in gorm-adapter as an example. Then extend to other Go adapters and even other languages of Casbin

@PokIsemaine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants