aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/views.py
diff options
context:
space:
mode:
authorTom Christie2012-08-24 20:57:10 +0100
committerTom Christie2012-08-24 20:57:10 +0100
commit87b363f7bc5f73d850df123a61895d65ec0b05e7 (patch)
tree1993adba1ad6a01c498c883babb157e3b4c7ee15 /djangorestframework/views.py
parent4e4584a01a4cf67c23aec21088110cd477ba841b (diff)
downloaddjango-rest-framework-87b363f7bc5f73d850df123a61895d65ec0b05e7.tar.bz2
Remove PermissionsMixin
Diffstat (limited to 'djangorestframework/views.py')
-rw-r--r--djangorestframework/views.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/djangorestframework/views.py b/djangorestframework/views.py
index f6a7a3bf..2ce36a9a 100644
--- a/djangorestframework/views.py
+++ b/djangorestframework/views.py
@@ -68,7 +68,7 @@ _resource_classes = (
)
-class View(ResourceMixin, PermissionsMixin, DjangoView):
+class View(ResourceMixin, DjangoView):
"""
Handles incoming requests and maps them to REST operations.
Performs request deserialization, response serialization, authentication and input validation.
@@ -96,7 +96,7 @@ class View(ResourceMixin, PermissionsMixin, DjangoView):
List of all authenticating methods to attempt.
"""
- permissions = (permissions.FullAnonAccess,)
+ permission_classes = (permissions.FullAnonAccess,)
"""
List of all permissions that must be checked.
"""
@@ -223,6 +223,19 @@ class View(ResourceMixin, PermissionsMixin, DjangoView):
"""
return self.renderers[0]
+ def get_permissions(self):
+ """
+ Instantiates and returns the list of permissions that this view requires.
+ """
+ return [permission(self) for permission in self.permission_classes]
+
+ def check_permissions(self, user):
+ """
+ Check user permissions and either raise an ``ImmediateResponse`` or return.
+ """
+ for permission in self.get_permissions():
+ permission.check_permission(user)
+
def initial(self, request, *args, **kargs):
"""
This method is a hook for any code that needs to run prior to