halfapi/tests/dummy_domain/routers/arguments/__init__.py
2022-08-19 18:45:45 +02:00

70 lines
1.3 KiB
Python

from ... import acl
from halfapi.lib.acl import ACL
from halfapi.logging import logger
@ACL([
{
'acl':acl.public,
'args': {
'required': {
'foo', 'bar'
},
'optional': {
'x'
}
}
},
{
'acl':acl.random,
'args': {
'required': {
'foo', 'baz'
},
'optional': {
'truebidoo'
}
}
},
])
def get(halfapi, data):
"""
description:
returns the configuration of the domain
"""
logger.error('%s', data['foo'])
return {'foo': data['foo'], 'bar': data['bar']}
@ACL([
{
'acl':acl.private,
'args': {
'required': {
'foo', 'bar'
},
'optional': {
'x'
}
}
},
{
'acl':acl.public,
'args': {
'required': {
'foo', 'baz'
},
'optional': {
'truebidoo'
}
}
},
])
def post(halfapi, data):
"""
description:
returns the configuration of the domain
"""
logger.error('%s', data)
return {'foo': data['foo'], 'bar': data.get('bar', data.get('baz'))}