Ticket #11545: default-permissions.diff
File default-permissions.diff, 1.5 KB (added by , 15 years ago) |
---|
-
docs/topics/auth.txt
209 209 .. method:: models.User.has_perm(perm) 210 210 211 211 Returns ``True`` if the user has the specified permission, where perm is 212 in the format ``"<application name>.<lowercased model name>"``. If the 213 user is inactive, this method will always return ``False``. 212 in the format ``"<application name>.<permission name>"`` (see 213 `permissions`_ section below). If the user is inactive, this method will 214 always return ``False``. 214 215 215 216 .. method:: models.User.has_perms(perm_list) 216 217 … … 1085 1086 def limited_object_detail(*args, **kwargs): 1086 1087 return object_detail(*args, **kwargs) 1087 1088 1089 .. _permissions: 1090 1088 1091 Permissions 1089 1092 =========== 1090 1093 … … 1114 1117 Default permissions 1115 1118 ------------------- 1116 1119 1120 Three default permissions are named after the application and the model. 1121 Assuming you have ``foo`` application with ``Bar`` model, in order to test 1122 for basic permissions you should use: 1123 1124 * add: ``user.has_perm('foo.add_bar')`` 1125 * change: ``user.has_perm('foo.change_bar')`` 1126 * delete: ``user.has_perm('foo.delete_bar')`` 1127 1117 1128 When ``django.contrib.auth`` is listed in your :setting:`INSTALLED_APPS` 1118 1129 setting, it will ensure that three default permissions -- add, change and 1119 1130 delete -- are created for each Django model defined in one of your installed