[halfdomain] fix last modification

This commit is contained in:
Maxime Alves LIRMM@home 2022-05-17 16:13:33 +02:00
parent 389823db82
commit 7dd7d00625
2 changed files with 6 additions and 6 deletions

View File

@ -96,21 +96,21 @@ class HalfDomain(Starlette):
@staticmethod
def acls(domain):
def acls(domain, acl=None):
""" Returns the ACLS constant for the given domain
"""
m_acl = HalfDomain.m_acl(domain)
m_acl = HalfDomain.m_acl(domain, acl)
try:
return getattr(m_acl, 'ACLS')
except AttributeError:
raise Exception(f'Missing acl.ACLS constant in {domain} module')
@staticmethod
def acls_route(domain):
def acls_route(domain, acl=None):
d_res = {}
m_acl = HalfDomain.m_acl(domain)
m_acl = HalfDomain.m_acl(domain, acl)
for acl_name, doc, order in HalfDomain.acls(domain):
for acl_name, doc, order in HalfDomain.acls(domain, acl):
fct = getattr(m_acl, acl_name)
d_res[acl_name] = {
'callable': fct,

View File

@ -209,7 +209,7 @@ class HalfAPI(Starlette):
def acls_route(self):
res = {
domain: HalfDomain.acls_route(domain)
domain: HalfDomain.acls_route(domain, domain_conf.get('acl'))
for domain, domain_conf in self.config.get('domain', {}).items()
if isinstance(domain_conf, dict) and domain_conf.get('enabled', False)
}