aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide
diff options
context:
space:
mode:
authorTom Christie2013-03-12 18:49:38 +0000
committerTom Christie2013-03-12 18:49:38 +0000
commite8db504a9802c6dcc111a327f681e01b9b3e2e16 (patch)
treecc85f273295484a0e145eee63b1f8d5af1701572 /docs/api-guide
parent12ac357559457d1ded341728aaf76408f0417f9b (diff)
parent20880232930dd6f3a1de9dda1546c84b9279a258 (diff)
downloaddjango-rest-framework-e8db504a9802c6dcc111a327f681e01b9b3e2e16.tar.bz2
Merge master
Diffstat (limited to 'docs/api-guide')
-rw-r--r--docs/api-guide/permissions.md7
1 files changed, 6 insertions, 1 deletions
diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md
index 2db6ce1e..719ac1ef 100644
--- a/docs/api-guide/permissions.md
+++ b/docs/api-guide/permissions.md
@@ -90,12 +90,17 @@ This permission is suitable if you want to your API to allow read permissions to
## DjangoModelPermissions
-This permission class ties into Django's standard `django.contrib.auth` [model permissions][contribauth]. When applied to a view that has a `.model` property, authorization will only be granted if the user has the relevant model permissions assigned.
+This permission class ties into Django's standard `django.contrib.auth` [model permissions][contribauth]. When applied to a view that has a `.model` property, authorization will only be granted if the user *is authenticated* and has the *relevant model permissions* assigned.
* `POST` requests require the user to have the `add` permission on the model.
* `PUT` and `PATCH` requests require the user to have the `change` permission on the model.
* `DELETE` requests require the user to have the `delete` permission on the model.
+If you want to use `DjangoModelPermissions` but also allow unauthenticated users to have read permission, override the class and set the `authenticated_users_only` property to `False`. For example:
+
+ class HasModelPermissionsOrReadOnly(DjangoModelPermissions):
+ authenticated_users_only = False
+
The default behaviour can also be overridden to support custom model permissions. For example, you might want to include a `view` model permission for `GET` requests.
To use custom model permissions, override `DjangoModelPermissions` and set the `.perms_map` property. Refer to the source code for details.