[fix] Remaining upper-case in returned dict and missing auth in yunohost.app

This commit is contained in:
Jérôme Lebleu 2014-05-15 12:10:09 +02:00
parent 24cbd03d47
commit ffcacf28f8
2 changed files with 20 additions and 15 deletions

View file

@ -487,10 +487,13 @@ app:
full: --sql full: --sql
help: Initial SQL file help: Initial SQL file
### app_makedefault() ### app_makedefault()
makedefault: makedefault:
action_help: Redirect domain root to an app action_help: Redirect domain root to an app
api: PUT /app/default api: PUT /app/default
configuration:
authenticate: all
authenticator: ldap-anonymous
arguments: arguments:
app: app:
help: App name to put on domain root help: App name to put on domain root

View file

@ -58,7 +58,7 @@ def app_listlists():
except OSError: except OSError:
raise MoulinetteError(1, m18n.n('no_list_found')) raise MoulinetteError(1, m18n.n('no_list_found'))
return { 'Lists' : list_list } return { 'lists' : list_list }
def app_fetchlist(url=None, name=None): def app_fetchlist(url=None, name=None):
@ -173,16 +173,16 @@ def app_list(offset=None, limit=None, filter=None, raw=False):
list_dict[app_id] = app_info list_dict[app_id] = app_info
else: else:
list_dict.append({ list_dict.append({
'ID': app_id, 'id': app_id,
'Name': app_info['manifest']['name'], 'name': app_info['manifest']['name'],
'Description': app_info['manifest']['description'], 'description': app_info['manifest']['description'],
'Installed': installed 'installed': installed
}) })
i += 1 i += 1
else: else:
break break
if not raw: if not raw:
list_dict = { 'Apps': list_dict } list_dict = { 'apps': list_dict }
return list_dict return list_dict
@ -208,8 +208,8 @@ def app_info(app, raw=False):
return app_info return app_info
else: else:
return { return {
'Name': app_info['manifest']['name'], 'name': app_info['manifest']['name'],
'Description': app_info['manifest']['description']['en'], 'description': app_info['manifest']['description']['en'],
#TODO: Add more infos #TODO: Add more infos
} }
@ -655,7 +655,8 @@ def app_clearaccess(auth, apps):
app_ssowatconf(auth) app_ssowatconf(auth)
def app_makedefault(app, domain=None):
def app_makedefault(auth, app, domain=None):
""" """
Redirect domain root to an app Redirect domain root to an app
@ -664,6 +665,8 @@ def app_makedefault(app, domain=None):
domain domain
""" """
from yunohost.domain import domain_list
if not _is_installed(app): if not _is_installed(app):
raise MoulinetteError(errno.EINVAL, m18n.n('app_not_installed') % app) raise MoulinetteError(errno.EINVAL, m18n.n('app_not_installed') % app)
@ -675,7 +678,7 @@ def app_makedefault(app, domain=None):
if domain is None: if domain is None:
domain = app_domain domain = app_domain
elif domain not in domain_list()['Domains']: elif domain not in domain_list(auth)['domains']:
raise MoulinetteError(errno.EINVAL, m18n.n('domain_unknown')) raise MoulinetteError(errno.EINVAL, m18n.n('domain_unknown'))
if '/' in app_map(raw=True)[domain]: if '/' in app_map(raw=True)[domain]:
@ -701,7 +704,6 @@ def app_makedefault(app, domain=None):
msignals.display(m18n.n('ssowat_conf_updated'), 'success') msignals.display(m18n.n('ssowat_conf_updated'), 'success')
def app_setting(app, key, value=None, delete=False): def app_setting(app, key, value=None, delete=False):
""" """
Set or get an app setting value Set or get an app setting value
@ -901,9 +903,9 @@ def app_ssowatconf(auth):
redirected_regex = { main_domain +'/yunohost[\/]?$': 'https://'+ main_domain +'/yunohost/sso/' } redirected_regex = { main_domain +'/yunohost[\/]?$': 'https://'+ main_domain +'/yunohost/sso/' }
apps = {} apps = {}
for app in app_list()['Apps']: for app in app_list()['apps']:
if _is_installed(app['ID']): if _is_installed(app['id']):
with open(apps_setting_path + app['ID'] +'/settings.yml') as f: with open(apps_setting_path + app['id'] +'/settings.yml') as f:
app_settings = yaml.load(f) app_settings = yaml.load(f)
if 'skipped_uris' in app_settings: if 'skipped_uris' in app_settings:
for item in app_settings['skipped_uris'].split(','): for item in app_settings['skipped_uris'].split(','):