diff options
| author | Sébastien Piquemal | 2012-02-23 22:47:45 +0200 |
|---|---|---|
| committer | Sébastien Piquemal | 2012-02-23 22:47:45 +0200 |
| commit | afd490238a38c5445013f030547b1019f484f0bc (patch) | |
| tree | d53ea67eae108c7c1d45aa52bb3f209155926349 /djangorestframework/views.py | |
| parent | 9da1ae81dc9a056db94ea07f35478ed003fea598 (diff) | |
| download | django-rest-framework-afd490238a38c5445013f030547b1019f484f0bc.tar.bz2 | |
authentication refactor : request.user + tests pass
Diffstat (limited to 'djangorestframework/views.py')
| -rw-r--r-- | djangorestframework/views.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/djangorestframework/views.py b/djangorestframework/views.py index 6bfc4192..509d1471 100644 --- a/djangorestframework/views.py +++ b/djangorestframework/views.py @@ -69,7 +69,7 @@ _resource_classes = ( ) -class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView): +class View(ResourceMixin, RequestMixin, ResponseMixin, PermissionsMixin, DjangoView): """ Handles incoming requests and maps them to REST operations. Performs request deserialization, response serialization, authentication and input validation. @@ -91,13 +91,13 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView): List of parser classes the resource can parse the request with. """ - authentication = (authentication.UserLoggedInAuthentication, + authentication_classes = (authentication.UserLoggedInAuthentication, authentication.BasicAuthentication) """ List of all authenticating methods to attempt. """ - permissions = (permissions.FullAnonAccess,) + permissions_classes = (permissions.FullAnonAccess,) """ List of all permissions that must be checked. """ @@ -206,15 +206,15 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView): # all other authentication is CSRF exempt. @csrf_exempt def dispatch(self, request, *args, **kwargs): - self.request = self.create_request(request) + self.request = request = self.create_request(request) self.args = args self.kwargs = kwargs try: self.initial(request, *args, **kwargs) - - # Authenticate and check request has the relevant permissions - self._check_permissions() + + # check that user has the relevant permissions + self.check_permissions(request.user) # Get the appropriate handler method if request.method.lower() in self.http_method_names: |
