-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
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
permissions.DjangoModelPermissionsOrAnonReadOnly
doesn't actually enable anonymous read-only access in 3.15
#9299
Comments
Confirmed. I thought I was going crazy. |
So... I think we should reassess and probably revert #8009, at least for a 3.15.1 release. (?) Requiring "view" permissions is a decent idea, but it unavoidably changes an existing behaviour in a way that's going to break some existing installations. Given that our permissions system was introduced before Django included the model "view" permission (I think?) it's not obvious that there's really a good way forward other than documenting what our built-in permissions do, and describing how to change them if needed. (Eg. how to require "view" permissions.) Is this the most sensible course of action on this one? |
If we were ignoring existing installations, it kind of feels like the plain Although that then raises the question of what So, yes, ignoring the "view" permission and documenting that is probably the most sensible route, at least in the short-term. |
Discussed in #9298
Originally posted by lpomfrey March 18, 2024
As the title states, it seems from DRF 3.15 the
permissions.DjangoModelPermissionsOrAnonReadOnly
doesn't actually allow anonymous read only access as it inherits the check for the view permission on the model frompermissions.DjangoModelPermissions
class.It would seem to replicate the older behaviour
DjangoModelPermissionsOrAnonReadOnly
should set'GET'
and'HEAD'
in theperms_map
to[]
(along with settingauthenticated_users_only = False
).I'm not sure if this is by design and the recommended solution is to compose a set of permissions like
permissions.DjangoModelPermissions | ReadOnly
(providing a customReadOnly
class), but the documentation still suggests it should work as it did in 3.14 and before.The text was updated successfully, but these errors were encountered: