Merge remote-tracking branch 'origin/unstable' into unstable

This commit is contained in:
Weblate 2016-01-27 21:44:05 +01:00
commit 610eec348b
2 changed files with 31 additions and 34 deletions

View file

@ -15,24 +15,11 @@ base dc=yunohost,dc=org
# The LDAP protocol version to use.
#ldap_version 3
# The DN to bind with for normal lookups.
#binddn cn=annonymous,dc=example,dc=net
#bindpw secret
# The DN used for password modifications by root.
#rootpwmoddn cn=admin,dc=example,dc=com
# SSL options
#ssl off
#tls_reqcert never
tls_cacertfile /etc/ssl/certs/ca-certificates.crt
# The search scope.
#scope sub
# Build a full list of non-LDAP users on startup.
nss_initgroups_ignoreusers ALLLOCAL
# The minimum numeric user id to lookup.
nss_min_uid 1000

View file

@ -253,34 +253,44 @@ def app_map(app=None, raw=False, user=None):
app -- Specific app to map
"""
apps = []
result = {}
for app_id in os.listdir(apps_setting_path):
if app and (app != app_id):
continue
if user is not None:
app_dict = app_info(app=app_id, raw=True)
if ('mode' not in app_dict['settings']) or ('mode' in app_dict['settings'] and app_dict['settings']['mode'] == 'private'):
if 'allowed_users' in app_dict['settings'] and user not in app_dict['settings']['allowed_users'].split(','):
continue
if app is not None:
if not _is_installed(app):
raise MoulinetteError(errno.EINVAL,
m18n.n('app_not_installed', app))
apps = [app,]
else:
apps = os.listdir(apps_setting_path)
for app_id in apps:
with open(apps_setting_path + app_id +'/settings.yml') as f:
app_settings = yaml.load(f)
if not isinstance(app_settings, dict):
continue
if 'domain' not in app_settings:
continue
if user is not None:
if ('mode' not in app_settings \
or ('mode' in app_settings \
and app_settings['mode'] == 'private')) \
and 'allowed_users' in app_settings \
and user not in app_settings['allowed_users'].split(','):
continue
domain = app_settings['domain']
path = app_settings.get('path', '/')
if raw:
if app_settings['domain'] not in result:
result[app_settings['domain']] = {}
result[app_settings['domain']][app_settings['path']] = {
'label': app_settings['label'],
'id': app_settings['id']
if domain not in result:
result[domain] = {}
result[domain][path] = {
'label': app_settings['label'],
'id': app_settings['id']
}
else:
result[app_settings['domain']+app_settings['path']] = app_settings['label']
result[domain + path] = app_settings['label']
return result