diff --git a/halfapi/lib/routes.py b/halfapi/lib/routes.py index e53bdf4..3ccd827 100644 --- a/halfapi/lib/routes.py +++ b/halfapi/lib/routes.py @@ -40,7 +40,20 @@ def get_routes(domains=None): for acl_fct_name, keys in acls: acl_fct = getattr(acls_mod, acl_fct_name) if acl_fct(req, *args, **kwargs): - return await fct(req, *args, **{ **kwargs, **{'keys': keys} }) + """ + We the 'acl' and 'keys' kwargs values to let the + decorated function know which ACL function answered + True, and which keys the request will return + """ + return await fct( + req, *args, + **{ + **kwargs, + **{ + 'acl': f'{acls_mod.__name__}.{acl_fct_name}', + 'keys': keys + } + }) raise HTTPException(401) diff --git a/halfapi/models/api.sql b/halfapi/models/api.sql index 38863e9..169749e 100644 --- a/halfapi/models/api.sql +++ b/halfapi/models/api.sql @@ -1,6 +1,6 @@ create schema api; -create type verb as enum ('POST', 'GET', 'PUT', 'DELETE'); +create type verb as enum ('POST', 'GET', 'PUT', 'PATCH', 'DELETE'); create table api.domain ( name text,