diff options
| author | Tom Christie | 2012-09-13 18:32:56 +0100 |
|---|---|---|
| committer | Tom Christie | 2012-09-13 18:32:56 +0100 |
| commit | 6c109ac60f891955df367c61d4d7094039098076 (patch) | |
| tree | 813962df0083994aa70e9e5c3f81f8bc677a583b /djangorestframework/permissions.py | |
| parent | b16c45aa6dfb5937d01f0c89273cd24f5e729f60 (diff) | |
| download | django-rest-framework-6c109ac60f891955df367c61d4d7094039098076.tar.bz2 | |
Improve throttles and docs
Diffstat (limited to 'djangorestframework/permissions.py')
| -rw-r--r-- | djangorestframework/permissions.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/djangorestframework/permissions.py b/djangorestframework/permissions.py index 64e455f5..3a669822 100644 --- a/djangorestframework/permissions.py +++ b/djangorestframework/permissions.py @@ -28,11 +28,11 @@ class BasePermission(object): """ self.view = view - def check_permission(self, request, obj=None): + def has_permission(self, request, obj=None): """ Should simply return, or raise an :exc:`response.ImmediateResponse`. """ - raise NotImplementedError(".check_permission() must be overridden.") + raise NotImplementedError(".has_permission() must be overridden.") class IsAuthenticated(BasePermission): @@ -40,7 +40,7 @@ class IsAuthenticated(BasePermission): Allows access only to authenticated users. """ - def check_permission(self, request, obj=None): + def has_permission(self, request, obj=None): if request.user and request.user.is_authenticated(): return True return False @@ -51,7 +51,7 @@ class IsAdminUser(BasePermission): Allows access only to admin users. """ - def check_permission(self, request, obj=None): + def has_permission(self, request, obj=None): if request.user and request.user.is_staff: return True return False @@ -62,7 +62,7 @@ class IsAuthenticatedOrReadOnly(BasePermission): The request is authenticated as a user, or is a read-only request. """ - def check_permission(self, request, obj=None): + def has_permission(self, request, obj=None): if (request.method in SAFE_METHODS or request.user and request.user.is_authenticated()): @@ -105,7 +105,7 @@ class DjangoModelPermissions(BasePermission): } return [perm % kwargs for perm in self.perms_map[method]] - def check_permission(self, request, obj=None): + def has_permission(self, request, obj=None): model_cls = self.view.model perms = self.get_required_permissions(request.method, model_cls) |
