diff options
Diffstat (limited to 'docs/api-guide/permissions.md')
| -rw-r--r-- | docs/api-guide/permissions.md | 6 | 
1 files changed, 6 insertions, 0 deletions
| diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md index c6372f98..a3d86ed4 100644 --- a/docs/api-guide/permissions.md +++ b/docs/api-guide/permissions.md @@ -47,6 +47,10 @@ If not specified, this setting defaults to allowing unrestricted access:  You can also set the authentication policy on a per-view, or per-viewset basis,  using the `APIView` class based views. +    from rest_framework.permissions import IsAuthenticated +	from rest_framework.responses import Response +	from rest_framework.views import APIView +      class ExampleView(APIView):          permission_classes = (IsAuthenticated,) @@ -157,6 +161,8 @@ For more details see the [2.2 release announcement][2.2-announcement].  The following is an example of a permission class that checks the incoming request's IP address against a blacklist, and denies the request if the IP has been blacklisted. +    from rest_framework import permissions +      class BlacklistPermission(permissions.BasePermission):          """          Global permission check for blacklisted IPs. | 
