aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/permissions.py
diff options
context:
space:
mode:
Diffstat (limited to 'rest_framework/permissions.py')
-rw-r--r--rest_framework/permissions.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py
index 1036663e..6d213ba1 100644
--- a/rest_framework/permissions.py
+++ b/rest_framework/permissions.py
@@ -7,7 +7,7 @@ import warnings
SAFE_METHODS = ['GET', 'HEAD', 'OPTIONS']
-from rest_framework.compat import oauth2_provider_scope, oauth2_constants
+from rest_framework.compat import oauth2_provider_scope, oauth2_constants, guardian
class BasePermission(object):
@@ -151,6 +151,11 @@ class DjangoModelPermissionsOrAnonReadOnly(DjangoModelPermissions):
authenticated_users_only = False
+class DjangoObjectLevelModelPermissions(DjangoModelPermissions):
+ def __init__(self):
+ assert guardian, 'Using DjangoObjectLevelModelPermissions, but guardian is not installed'
+
+
class TokenHasReadWriteScope(BasePermission):
"""
The request is authenticated as a user and the token used has the right scope