change get_permissions to return list #500
Draft
+23
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have made things!
Proposal to change the signature of
get_permissions
tolist[BasePermission]
. This allows one to customize the permissions of a view as suggested by the documentation: https://www.django-rest-framework.org/api-guide/permissions/#overview-of-access-restriction-methodsThe source code also suggests that is is a
list
:https://github.com/encode/django-rest-framework/blob/f56b85b7dd7e4f786e0769bba6b7609d4507da83/rest_framework/views.py#L278
It was originally changed in #320 to
Sequence[_SupportsHasPermission]
.I am not sure if the element type has to be_SupportsHasPermission
instead ofBasePermission
. All the other method signatures use the base type.Update: In the end I reverted back for the same reason why the return type was changed to
Sequence
in #320 and added a few more test cases.Related issues
Refs #319 (PR: #320)