-
-
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
DjangoModelPermissions does not respect Django can_read_model
permissoin
#6324
Comments
Pre-Django 2.1 there wasn't a built-in "read-only" permission. The framework chooses "fail-open" instead of "fail-close" here, which isn't the default that I'd expect; however now that there is an explicit This would be a breaking change, since any code that's depending on the default read-only behaviour would break. Is that desirable? The fix itself is trivial. |
Breaking back-compat might not be desirable; if so would it be worth adding a subclass that does respect the permission? Something like this would be an option:
|
Hi everyone, there's a patch which adds support for view permission and is backward compatible: #8009. |
This is great, I hope this PR can be merged. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
) * Fix Respect `can_read_model` permission in DjangoModelPermissions FIXES: #6324 * Updated documentation and simplified code
Checklist
master
branch of Django REST framework.Steps to reproduce
Use
DjangoModelPermissions
on a ViewSet, and access with a user that does not havecan_view_<model>
permisson.Expected behavior
The user should not be able to view the model, as they don't have the required permission.
Actual behavior
All authenticated users are granted read-only permission.
The text was updated successfully, but these errors were encountered: