Ajout de l'option "check" permettant de connaître l'acl qui passe

This commit is contained in:
Maxime Alves LIRMM@home 2021-04-22 17:30:21 +02:00
parent e1c3d61207
commit 4eb23fd189
1 changed files with 4 additions and 1 deletions

View File

@ -8,7 +8,7 @@ from types import ModuleType, FunctionType
from starlette.exceptions import HTTPException from starlette.exceptions import HTTPException
from starlette.routing import Route from starlette.routing import Route
from starlette.requests import Request from starlette.requests import Request
from starlette.responses import Response from starlette.responses import Response, PlainTextResponse
from halfapi.lib.domain import gen_domain_routes, VERBS from halfapi.lib.domain import gen_domain_routes, VERBS
@ -52,6 +52,9 @@ def route_acl_decorator(fct: Callable, params: List[Dict]):
req.scope['acl_pass'] = param['acl'].__name__ req.scope['acl_pass'] = param['acl'].__name__
if 'check' in req.query_params:
return PlainTextResponse(param['acl'].__name__)
return await fct( return await fct(
req, *args, req, *args,
**{ **{