Should "has_object_permission" call "has_permission" as default instead of returning always "True"? #9612
Replies: 1 comment 2 replies
-
DRF took another approach as described in the docs:
The base django-rest-framework/rest_framework/views.py Line 421 in 2ede857 And the generic view checks for object permissions while trying to fetch the individual instance for details endpoints: Taking a step back, if you get |
Beta Was this translation helpful? Give feedback.
-
Hi, there.
Short description: The method
BasePermission.has_object_permission
is returning a inconsistent value.I was trying to implement a more complex permission check using custom permissions and noticed an inconsistency in the final result. In my case, I have a permission that checks for specific action names and then verifies the user type. The problem occurs when I need to verify object-level permissions. While 'has_permission' returns 'False', 'has_object_permission' returns 'True'. For consistency, wouldn't it be correct to call
has_object_permission
by default?My code:
How I solved it:
How to reproduce
Beta Was this translation helpful? Give feedback.
All reactions