mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-03 12:00:12 +03:00
Merge 69cf7169f4
into 522d453546
This commit is contained in:
commit
0577546377
|
@ -210,3 +210,15 @@ class DjangoObjectPermissions(DjangoModelPermissions):
|
|||
return False
|
||||
|
||||
return True
|
||||
|
||||
class IsAnonymousOrReadOnly(BasePermission):
|
||||
"""
|
||||
The request from anonymous user is accepted, or is a read-only request.
|
||||
"""
|
||||
|
||||
def has_permission(self, request, view):
|
||||
return (
|
||||
request.method in SAFE_METHODS or
|
||||
request.user and
|
||||
request.user.is_anonymous
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user