-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
88 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
"""Permissions configured using django-rules.""" | ||
"""Permissions for the tokens app""" | ||
|
||
import rules | ||
|
||
# Projectroles dependency | ||
from projectroles import rules as pr_rules # To access common predicates | ||
|
||
# tokens.access -- Access to the tokens app. | ||
rules.add_perm('tokens.access', rules.is_active) | ||
|
||
# View tokens list | ||
rules.add_perm('tokens.view_list', rules.is_authenticated) | ||
|
||
# Create token | ||
rules.add_perm( | ||
'tokens.create', rules.is_authenticated & pr_rules.is_site_writable | ||
) | ||
|
||
# Delete token | ||
rules.add_perm( | ||
'tokens.delete', rules.is_authenticated & pr_rules.is_site_writable | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters