Should "has_object_permission" call "has_permission" as default instead of returning always "True"? #9612
Replies: 2 comments 6 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.
-
| 
         Considering that there have been no interactions for a few weeks, I'm closing the question. I thank @browniebroke for his willingness and attention. The answer that I've interpreted is: Create a custom base permission.  | 
  
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, there.
Short description: The method
BasePermission.has_object_permissionis 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_permissionby default?My code:
How I solved it:
How to reproduce
Beta Was this translation helpful? Give feedback.
All reactions