We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
https://www.django-rest-framework.org/api-guide/permissions/#object-level-permissions
def get_object(self): obj = get_object_or_404(self.get_queryset(), pk=self.kwargs["pk"]) self.check_object_permissions(self.request, obj) return obj
So get_object already has check_permissions call. So it would be nice to impelement has_object_permission (https://github.com/encode/django-rest-framework/blob/master/rest_framework/permissions.py#L112).
get_object
has_object_permission
It will have the same logic as has_permission but provide additional attribute object into conditions functions.
has_permission
object
Signature of conditions would be f(self, request, view, action, object=None) -> bool. And object-level conditions should have this check:
f(self, request, view, action, object=None) -> bool
if object is None: return True
P.S. If you agree with this I could impelement it and create PR.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://www.django-rest-framework.org/api-guide/permissions/#object-level-permissions
So
get_object
already has check_permissions call. So it would be nice to impelementhas_object_permission
(https://github.com/encode/django-rest-framework/blob/master/rest_framework/permissions.py#L112).It will have the same logic as
has_permission
but provide additional attributeobject
into conditions functions.Signature of conditions would be
f(self, request, view, action, object=None) -> bool
. And object-level conditions should have this check:P.S. If you agree with this I could impelement it and create PR.
The text was updated successfully, but these errors were encountered: