Last active
May 20, 2017 10:49
-
-
Save evgeni/357918223d418025be1da967774acec5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework import permissions | |
class IsAuthenticatedDD(permissions.BasePermission): | |
""" | |
Allows access only to authenticated users who are DDs. | |
Based on IsAuthenticated | |
https://github.com/encode/django-rest-framework/blob/master/rest_framework/permissions.py#L44 | |
""" | |
def has_permission(self, request, view): | |
return request.user and is_authenticated(request.user) and request.user.is_dd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment