Merge pull request #1122 from YunoHost/avoid_calling_app_list_in_user_permission_list

[mod] avoid calling app_list in user_permission_list
This commit is contained in:
Alexandre Aubin 2021-01-01 18:44:58 +01:00 committed by GitHub
commit 968a707a4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -51,7 +51,7 @@ def user_permission_list(short=False, full=False, ignore_system_perms=False, abs
""" """
# Fetch relevant informations # Fetch relevant informations
from yunohost.app import app_setting, app_list from yunohost.app import app_setting, _installed_apps
from yunohost.utils.ldap import _get_ldap_interface, _ldap_path_extract from yunohost.utils.ldap import _get_ldap_interface, _ldap_path_extract
ldap = _get_ldap_interface() ldap = _get_ldap_interface()
permissions_infos = ldap.search('ou=permission,dc=yunohost,dc=org', permissions_infos = ldap.search('ou=permission,dc=yunohost,dc=org',
@ -60,7 +60,7 @@ def user_permission_list(short=False, full=False, ignore_system_perms=False, abs
'URL', 'additionalUrls', 'authHeader', 'label', 'showTile', 'isProtected']) 'URL', 'additionalUrls', 'authHeader', 'label', 'showTile', 'isProtected'])
# Parse / organize information to be outputed # Parse / organize information to be outputed
apps = [app["id"] for app in app_list()["apps"]] apps = sorted(_installed_apps())
apps_base_path = {app: app_setting(app, 'domain') + app_setting(app, 'path') apps_base_path = {app: app_setting(app, 'domain') + app_setting(app, 'path')
for app in apps for app in apps
if app_setting(app, 'domain') and app_setting(app, 'path')} if app_setting(app, 'domain') and app_setting(app, 'path')}