mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Impove _get_full_url management
This commit is contained in:
parent
85cab0edbe
commit
353b29613d
2 changed files with 3 additions and 5 deletions
|
@ -35,7 +35,7 @@ class MyMigration(Migration):
|
||||||
|
|
||||||
logger.info(m18n.n("migration_0015_add_new_attributes_in_ldap"))
|
logger.info(m18n.n("migration_0015_add_new_attributes_in_ldap"))
|
||||||
ldap = _get_ldap_interface()
|
ldap = _get_ldap_interface()
|
||||||
permission_list = user_permission_list(short=True)["permissions"]
|
permission_list = user_permission_list(short=True, full_path=False)["permissions"]
|
||||||
|
|
||||||
for permission in permission_list:
|
for permission in permission_list:
|
||||||
if permission.split('.')[0] in SYSTEM_PERMS:
|
if permission.split('.')[0] in SYSTEM_PERMS:
|
||||||
|
|
|
@ -82,8 +82,8 @@ def user_permission_list(short=False, full=False, ignore_system_perms=False, ful
|
||||||
permissions[name]["show_tile"] = infos.get("showTile", [False])[0] == "TRUE"
|
permissions[name]["show_tile"] = infos.get("showTile", [False])[0] == "TRUE"
|
||||||
permissions[name]["protected"] = infos.get("isProtected", [False])[0] == "TRUE"
|
permissions[name]["protected"] = infos.get("isProtected", [False])[0] == "TRUE"
|
||||||
if full_path and name.split(".")[0] in apps_main_path:
|
if full_path and name.split(".")[0] in apps_main_path:
|
||||||
permissions[name]["url"] = _get_full_url(infos.get("URL", [None])[0], apps_main_path[name.split('.')[0]])
|
permissions[name]["url"] = _get_full_url(infos["URL"][0], apps_main_path[name.split('.')[0]]) if "URL" in infos else None
|
||||||
permissions[name]["additional_urls"] = [_get_full_url(url, apps_main_path[name.split('.')[0]]) for url in infos.get("additionalUrls", [None])]
|
permissions[name]["additional_urls"] = [_get_full_url(url, apps_main_path[name.split('.')[0]]) for url in infos.get("additionalUrls", [None]) if url]
|
||||||
else:
|
else:
|
||||||
permissions[name]["url"] = infos.get("URL", [None])[0]
|
permissions[name]["url"] = infos.get("URL", [None])[0]
|
||||||
permissions[name]["additional_urls"] = infos.get("additionalUrls", [None])
|
permissions[name]["additional_urls"] = infos.get("additionalUrls", [None])
|
||||||
|
@ -608,8 +608,6 @@ def _update_ldap_group_permission(permission, allowed,
|
||||||
|
|
||||||
|
|
||||||
def _get_full_url(url, app_main_path):
|
def _get_full_url(url, app_main_path):
|
||||||
if url is None:
|
|
||||||
return None
|
|
||||||
if url.startswith('/'):
|
if url.startswith('/'):
|
||||||
return app_main_path + url.rstrip("/")
|
return app_main_path + url.rstrip("/")
|
||||||
if url.startswith('re:/'):
|
if url.startswith('re:/'):
|
||||||
|
|
Loading…
Add table
Reference in a new issue