diff options
| author | Tom Christie | 2012-11-09 13:49:52 +0000 |
|---|---|---|
| committer | Tom Christie | 2012-11-09 13:49:52 +0000 |
| commit | 8953a60196cb55ec75902882314da5a42636349c (patch) | |
| tree | 43bf6ea1f69955aeecd83fb9f866d92ea9a5f3df /rest_framework/permissions.py | |
| parent | b78872b7dbb55f1aa2d21f15fbb952f0c7156326 (diff) | |
| parent | 9aaeeacdfebc244850e82469e4af45af252cca4d (diff) | |
| download | django-rest-framework-8953a60196cb55ec75902882314da5a42636349c.tar.bz2 | |
Merge with master
Diffstat (limited to 'rest_framework/permissions.py')
| -rw-r--r-- | rest_framework/permissions.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py index 6f848cee..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. @@ -85,7 +96,7 @@ class DjangoModelPermissions(BasePermission): """ kwargs = { 'app_label': model_cls._meta.app_label, - 'model_name': model_cls._meta.module_name + 'model_name': model_cls._meta.module_name } return [perm % kwargs for perm in self.perms_map[method]] |
