mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
simplify routing
This commit is contained in:
parent
c6143ead4e
commit
e4a69c5e95
4 changed files with 7 additions and 19 deletions
|
@ -95,7 +95,7 @@ user:
|
|||
### user_delete()
|
||||
delete:
|
||||
action_help: Delete user
|
||||
api: 'DELETE /users/(?P<users>[^/]+)'
|
||||
api: 'DELETE /users/{users}'
|
||||
arguments:
|
||||
-u:
|
||||
full: --users
|
||||
|
@ -109,7 +109,7 @@ user:
|
|||
### user_update()
|
||||
update:
|
||||
action_help: Update user informations
|
||||
api: 'PUT /users/(?P<username>[^/]+)'
|
||||
api: 'PUT /users/{username}'
|
||||
arguments:
|
||||
username:
|
||||
help: Username of user to update
|
||||
|
@ -143,7 +143,7 @@ user:
|
|||
### user_info()
|
||||
info:
|
||||
action_help: Get user informations
|
||||
api: 'GET /users/(?P<username>[^/]+)'
|
||||
api: 'GET /users/{username}'
|
||||
arguments:
|
||||
username:
|
||||
help: Username or mail to get informations
|
||||
|
@ -188,7 +188,7 @@ domain:
|
|||
### domain_remove()
|
||||
remove:
|
||||
action_help: Delete domains
|
||||
api: 'DELETE /domains/(?P<domains>[^/]+)'
|
||||
api: 'DELETE /domains/{domains}'
|
||||
arguments:
|
||||
domains:
|
||||
help: Domain(s) to delete
|
||||
|
@ -198,7 +198,7 @@ domain:
|
|||
### domain_info()
|
||||
info:
|
||||
action_help: Get domain informations
|
||||
api: 'GET /domains/(?P<domain>[^/]+)'
|
||||
api: 'GET /domains/{domain}'
|
||||
arguments:
|
||||
domain:
|
||||
help: ""
|
||||
|
|
|
@ -59,7 +59,6 @@ def main():
|
|||
action_params['api'] = 'GET /'+ category +'/'+ action
|
||||
|
||||
method, path = action_params['api'].split(' ')
|
||||
path = path.replace('(?P<', '{').replace('>[^/]+)', '}')
|
||||
key_param = ''
|
||||
if '{' in path:
|
||||
key_param = path[path.find("{")+1:path.find("}")]
|
||||
|
|
|
@ -186,6 +186,8 @@ def main():
|
|||
action_params['api'] = 'GET /'+ category +'/'+ action
|
||||
method, path = action_params['api'].split(' ')
|
||||
# Register route
|
||||
if '{' in path:
|
||||
path = path.replace('{', '(?P<').replace('}', '>[^/]+)')
|
||||
api.register(method, path, http_exec)
|
||||
api.register('OPTIONS', path, http_exec)
|
||||
action_dict[action_params['api']] = {
|
||||
|
|
|
@ -28,19 +28,6 @@ def tools_ldapinit():
|
|||
for rdn, attr_dict in ldap_map['children'].items():
|
||||
yldap.add(rdn, attr_dict)
|
||||
|
||||
try:
|
||||
with open('/etc/yunohost/from_script') as f: pass
|
||||
except IOError:
|
||||
with open('sudo_ldap_scheme.yml') as f:
|
||||
ldap_map = yaml.load(f)
|
||||
|
||||
for rdn, attr_dict in ldap_map['parents'].items():
|
||||
yldap.add(rdn, attr_dict)
|
||||
|
||||
for rdn, attr_dict in ldap_map['children'].items():
|
||||
yldap.add(rdn, attr_dict)
|
||||
|
||||
|
||||
admin_dict = {
|
||||
'cn': 'admin',
|
||||
'uid': 'admin',
|
||||
|
|
Loading…
Reference in a new issue