diff options
| author | Tom Christie | 2012-10-27 20:17:49 +0100 |
|---|---|---|
| committer | Tom Christie | 2012-10-27 20:17:49 +0100 |
| commit | af96fe05d0138c34128fc3944fc2701cbad5bd01 (patch) | |
| tree | 5ba2df36c975501007300d3e6bb0b7a4e392ab1f /rest_framework | |
| parent | d995742afc09ff8d387751a6fe47b9686845740b (diff) | |
| download | django-rest-framework-af96fe05d0138c34128fc3944fc2701cbad5bd01.tar.bz2 | |
Add AllowAny class
Diffstat (limited to 'rest_framework')
| -rw-r--r-- | rest_framework/permissions.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py index 51e96196..655b78a3 100644 --- a/rest_framework/permissions.py +++ b/rest_framework/permissions.py @@ -18,6 +18,17 @@ class BasePermission(object): raise NotImplementedError(".has_permission() must be overridden.") +class AllowAny(BasePermission): + """ + Allow any access. + This isn't strictly required, since you could use an empty + permission_classes list, but it's useful because it makes the intention + more explicit. + """ + def has_permission(self, request, view, obj=None): + return True + + class IsAuthenticated(BasePermission): """ Allows access only to authenticated users. |
