Set mandatory domain and path to add url in permission

This commit is contained in:
Josué Tille 2020-04-04 00:14:47 +02:00
parent 45bb5f4b35
commit 6e5e118bcf
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF
2 changed files with 7 additions and 2 deletions

View file

@ -578,6 +578,7 @@
"tools_upgrade_special_packages_completed": "YunoHost package upgrade completed.\nPress [Enter] to get the command line back", "tools_upgrade_special_packages_completed": "YunoHost package upgrade completed.\nPress [Enter] to get the command line back",
"unbackup_app": "App '{app:s}' will not be saved", "unbackup_app": "App '{app:s}' will not be saved",
"unexpected_error": "Something unexpected went wrong: {error}", "unexpected_error": "Something unexpected went wrong: {error}",
"unknown_main_domain_path": "Unknown domain or path for app '{app}'. You need to specify a domain and a path to be able to specify a url for permission.",
"unlimit": "No quota", "unlimit": "No quota",
"unrestore_app": "App '{app:s}' will not be restored", "unrestore_app": "App '{app:s}' will not be restored",
"update_apt_cache_failed": "Could not to update the cache of APT (Debian's package manager). Here is a dump of the sources.list lines, which might help identify problematic lines: \n{sourceslist}", "update_apt_cache_failed": "Could not to update the cache of APT (Debian's package manager). Here is a dump of the sources.list lines, which might help identify problematic lines: \n{sourceslist}",

View file

@ -341,6 +341,10 @@ def permission_url(operation_logger, permission,
if "." not in permission: if "." not in permission:
permission = permission + ".main" permission = permission + ".main"
if url or add_url:
if app_setting(permission.split('.')[0], 'domain') is None or app_setting(permission.split('.')[0], 'path') is None:
raise YunohostError('unknown_main_domain_path', app=permission.split('.')[0])
else:
# App main path in setting to manage conflict # App main path in setting to manage conflict
app_main_path = app_setting(permission.split('.')[0], 'domain') + app_setting(permission.split('.')[0], 'path') app_main_path = app_setting(permission.split('.')[0], 'domain') + app_setting(permission.split('.')[0], 'path')