Closed
Description
I noticed that when using permissions.IsAuthenticated
, the APIRootView
returns a 403
. However, when using DjangoModelPermissions
this is not the case. It does show the root with all available endpoints.
DjangoModelPermissions.has_permission(...)
does have a check to ensure the user is authenticated in the code (introduced in #5376) but it happens after the special case handling is done for APIRootView
(introduced in #2905).
django-rest-framework/rest_framework/permissions.py
Lines 219 to 227 in 7e4e6d2
The authentication check should come first followed by the special case for APIRootView
to be consistent with other permission classes.
I would be happy to provide a PR to address this.