mirror of
https://github.com/jazzband/django-authority.git
synced 2026-05-01 12:14:50 +00:00
Docs: Added a tip and a trick.
This commit is contained in:
parent
b82700f6b4
commit
2ad6876e07
1 changed files with 13 additions and 1 deletions
|
|
@ -18,4 +18,16 @@ Within a permission class, you can refer to the user and group using self::
|
|||
You can unregister permission classes and re-register them::
|
||||
|
||||
authority.unregister(Campaign)
|
||||
authority.register(Campaign, CampaignPermission)
|
||||
authority.register(Campaign, CampaignPermission)
|
||||
|
||||
Within a permission class, you can refer to Django's basic permissions::
|
||||
|
||||
class FlagpagePermisson(permissions.BasePermission):
|
||||
label = 'flatpage_permission'
|
||||
checks = ('do_foo',)
|
||||
|
||||
def do_foo(self, campaign=None):
|
||||
if foo and self.change_flatpage():
|
||||
# ...
|
||||
|
||||
authority.register(Flatpage, FlagpagePermisson)
|
||||
Loading…
Reference in a new issue