Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[1.3.X] Fixed #16094: Added clear example of how to refer to custom p…
…ermissions. Backport of [16813] from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@16814 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
ubernostrum committed Sep 11, 2011
1 parent 16787c6 commit 4601509
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docs/topics/auth.txt
Expand Up @@ -1251,16 +1251,19 @@ can or cannot do with Task instances, specific to your application::
...
class Meta:
permissions = (
("can_view", "Can see available tasks"),
("can_change_status", "Can change the status of tasks"),
("can_close", "Can remove a task by setting its status as closed"),
("view_task", "Can see available tasks"),
("change_task_status", "Can change the status of tasks"),
("close_task", "Can remove a task by setting its status as closed"),
)

The only thing this does is create those extra permissions when you run
:djadmin:`manage.py syncdb <syncdb>`. Your code is in charge of checking the
value of these permissions when an user is trying to access the functionality
provided by the application (viewing tasks, changing the status of tasks,
closing tasks.)
closing tasks.) Continuing the above example, the following checks if a user may
view tasks:

user.has_perm('app.view_task')

API reference
-------------
Expand Down

0 comments on commit 4601509

Please sign in to comment.