From 87b363f7bc5f73d850df123a61895d65ec0b05e7 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 24 Aug 2012 20:57:10 +0100 Subject: Remove PermissionsMixin --- djangorestframework/views.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'djangorestframework/views.py') 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 -- cgit v1.2.3