Last active
December 20, 2015 12:18
-
-
Save utek/6129509 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Root(object): | |
__acl__ = [ | |
(Allow, Authenticated, 'create_user'), | |
(Allow, Authenticated, 'view_user_links'), | |
] | |
def __init__(self, request): | |
self.request = request | |
# main() z __init__.py | |
config = Configurator(settings=settings, | |
authentication_policy=authentication_policy, | |
authorization_policy=authorization_policy, | |
session_factory=session_factory, | |
root_factory=Root | |
) | |
# widoki | |
@forbidden_view_config() | |
def forbidden_view(request): | |
if authenticated_userid(request): | |
return HTTPForbidden() | |
request.session['next'] = request.path | |
request.session.flash("Please sign in or sign on", 'info') | |
return HTTPFound(location=request.route_url('home')) | |
@view_config(route_name="create_user", renderer='linkr:templates/apps/act/index.mako', permission='create_user') | |
def create_user(request): | |
return {} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment