Ticket #8145: 8145.diff
File 8145.diff, 1.3 KB (added by , 15 years ago) |
---|
-
docs/topics/auth.txt
212 212 .. method:: models.User.has_perm(perm) 213 213 214 214 Returns ``True`` if the user has the specified permission, where perm is 215 in the format ``"<app label>.<permission codename>"``. 216 If the user is inactive, this method will always return ``False``. 215 in the format ``"<app label>.<permission codename>"``. (see 216 `permissions`_ section below). If the user is inactive, this method will 217 always return ``False``. 217 218 218 219 .. method:: models.User.has_perms(perm_list) 219 220 … … 1099 1100 def limited_object_detail(*args, **kwargs): 1100 1101 return object_detail(*args, **kwargs) 1101 1102 1103 .. _permissions: 1104 1102 1105 Permissions 1103 1106 =========== 1104 1107 … … 1141 1144 permissions for new models each time you run :djadmin:`manage.py syncdb 1142 1145 <syncdb>`. 1143 1146 1147 Assuming you have an application with 1148 :attr:`~django.db.models.Options.app_label` ``foo`` and a model named ``Bar``, 1149 to test for basic permissions you should use: 1150 1151 * add: ``user.has_perm('foo.add_bar')`` 1152 * change: ``user.has_perm('foo.change_bar')`` 1153 * delete: ``user.has_perm('foo.delete_bar')`` 1154 1144 1155 .. _custom-permissions: 1145 1156 1146 1157 Custom permissions