From d4a6bb1a048076205c3d3395042e7572e3e6ab9a Mon Sep 17 00:00:00 2001 From: "Maxime Alves LIRMM@home" Date: Mon, 9 Nov 2020 21:25:07 +0100 Subject: [PATCH] [domainMW] set "acl_pass" variable into scope --- halfapi/lib/domain.py | 1 + halfapi/lib/routes.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/halfapi/lib/domain.py b/halfapi/lib/domain.py index 942495d..29ddcdc 100644 --- a/halfapi/lib/domain.py +++ b/halfapi/lib/domain.py @@ -125,6 +125,7 @@ def gen_router_routes(m_router: ModuleType, path: List[str]) -> Generator: if not hasattr(m_router, 'ROUTES'): logger.error(f'Missing *ROUTES* constant in *{m_router.__name__}*') + raise Exception(f'No ROUTES constant for {m_router.__name__}') routes = m_router.ROUTES diff --git a/halfapi/lib/routes.py b/halfapi/lib/routes.py index c65c788..0f21f3d 100644 --- a/halfapi/lib/routes.py +++ b/halfapi/lib/routes.py @@ -48,6 +48,8 @@ def route_acl_decorator(fct: Callable, params: List[Dict]): logger.debug(f'ACL OK for current route ({fct} - {param.get("acl")})') + req.scope['acl_pass'] = param['acl'].__name__ + return await fct( req, *args, **{