[acls] added "fields" value for acl table
This commit is contained in:
parent
87cc59849a
commit
c97fa3b4c2
|
@ -85,19 +85,21 @@ def update_db(domain):
|
|||
Inserts ACL into database
|
||||
|
||||
Parameters:
|
||||
- acls (List[Callable]): List of the Route's ACL's
|
||||
- acls [(Callable, [str])]: List of the Route's ACL's
|
||||
- route (dict): The Route
|
||||
"""
|
||||
route.pop('fct_name')
|
||||
acl = Acl(**route)
|
||||
|
||||
for fct in acls:
|
||||
for fct, keys in acls:
|
||||
acl.acl_fct_name = fct.__name__
|
||||
|
||||
if len(acl) == 0:
|
||||
if fct is not None:
|
||||
add_acl_fct(fct)
|
||||
|
||||
if len(acl) != 0:
|
||||
raise Exception(
|
||||
'An ACL row for this route with this function already exists. Check your routers')
|
||||
else:
|
||||
acl.keys = keys
|
||||
add_acl_fct(fct)
|
||||
acl.insert()
|
||||
|
||||
elif fct is None:
|
||||
|
@ -223,6 +225,7 @@ def update_db(domain):
|
|||
click.echo(f'The domain {domain} has no *{router_name}* router', err=True)
|
||||
continue
|
||||
|
||||
|
||||
try:
|
||||
add_router(router_name)
|
||||
except Exception as e:
|
||||
|
|
|
@ -48,6 +48,7 @@ create table api.acl (
|
|||
router text,
|
||||
domain text,
|
||||
acl_fct_name text,
|
||||
keys text[],
|
||||
primary key (http_verb, path, router, domain, acl_fct_name)
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue