Hello,
I think I found some undesired behaviour, but would like to make sure it isn't an usage problem before opening and issue and PR on Github.
Consider, if you please, the following code (trimmed down to the relevant stuff):
https://gist.github.com/lcsfelix/afc5a62ba1379f85173b58145453ff16
Now, the question:
The
BasePermission class implements two methods:
has_permissions and
has_object_permissions. They both simply return
True.
The
IsAuthenticated,
IsAdminUser, and
IsAuthenticatedOrReadOnly classes extend
BasePermission but only override
has_permissions.
When the above code receives a PATCH request, it allows any user to complete the operation despite
not being an admin, because
IsAdminUser.
has_object_permissions always returns
True and therefore no other rules are checked.
Shouldn't these Permissions classes consider object level permissions?
Best regards,
Luis Félix