You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
''' Resources for account registraion and settings ''' |
|
|
|
from pyramid.security import Allow, Authenticated, Everyone, Deny, DENY_ALL |
|
|
|
from ordr2.resources.base import BaseResource |
|
|
|
|
|
class AccountResource(BaseResource): |
|
''' Resouce class for account registration and settings ''' |
|
|
|
#: name of the main navigation section for template highlighting |
|
nav_section = 'account' |
|
|
|
def __init__(self, name, parent, model=None): |
|
''' Create a base resource ''' |
|
super().__init__(name, parent) |
|
# the current model depends is the current logged in user or None |
|
self.model = self.request.user |
|
|
|
def __acl__(self): |
|
''' access controll list for the resource |
|
|
|
- everyone can log in our log out |
|
- authenticated users can change their settings |
|
- unauthenticated users can register |
|
|
|
''' |
|
return [ |
|
(Allow, Everyone, 'login'), |
|
(Allow, Everyone, 'logout'), |
|
(Deny, Authenticated, 'register'), |
|
(Allow, Everyone, 'register'), |
|
(Allow, Authenticated, 'settings'), |
|
] |
|
|
|
|