diff --git a/tailbone/webapi.py b/tailbone/webapi.py index b623bd70..a437f0c3 100644 --- a/tailbone/webapi.py +++ b/tailbone/webapi.py @@ -32,6 +32,7 @@ from pyramid.authentication import SessionAuthenticationPolicy from tailbone import app from tailbone.auth import TailboneAuthorizationPolicy +from tailbone.providers import get_all_providers def make_rattail_config(settings): @@ -46,6 +47,7 @@ def make_pyramid_config(settings): """ Make a Pyramid config object from the given settings. """ + rattail_config = settings['rattail_config'] pyramid_config = Configurator(settings=settings, root_factory=app.Root) # configure user authorization / authentication @@ -77,6 +79,13 @@ def make_pyramid_config(settings): else: pyramid_config.include('pyramid_retry') + # fetch all tailbone providers + providers = get_all_providers(rattail_config) + for provider in providers.values(): + + # configure DB sessions associated with transaction manager + provider.configure_db_sessions(rattail_config, pyramid_config) + # add some permissions magic pyramid_config.add_directive('add_tailbone_permission_group', 'tailbone.auth.add_permission_group') pyramid_config.add_directive('add_tailbone_permission', 'tailbone.auth.add_permission')