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

[RBAC] A version of has_obj_perm for multiple permissions #221

Open
AlanCoding opened this issue Mar 15, 2024 · 0 comments
Open

[RBAC] A version of has_obj_perm for multiple permissions #221

AlanCoding opened this issue Mar 15, 2024 · 0 comments
Labels
app:rbac code quality This item relates to code quality ready to work Item is ready to be worked on

Comments

@AlanCoding
Copy link
Member

The standard call from libraries is this:

https://github.com/encode/django-rest-framework/blob/a677b09729ed71014d65b90a86f75c47bf7ae32f/rest_framework/permissions.py#L299

if not user.has_perms(perms, obj):

But I called user.has_obj_perm with each permission. Why? Because I'm lazy. There was no reason, whatsoever, not to do it this better way. Yes, you can check all the object-level permissions in a single query. That would need to be implemented in a public method attached to the user model, or modify existing method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app:rbac code quality This item relates to code quality ready to work Item is ready to be worked on
Projects
None yet
Development

No branches or pull requests

1 participant