From 99e70af08ce6a6f1bf94e8c27af70a6e209902fe Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 2 Dec 2019 18:09:43 +0100 Subject: [PATCH] Additonal cleaning of legacy stuff when using new permission system + avoid duplicated entries in (un)protected_urls --- src/yunohost/app.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 0e4a473b4..8897cb427 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -1328,16 +1328,18 @@ def app_ssowatconf(): # FIXME : gotta handle regex-urls here... meh url = _sanitized_absolute_url(perm_info["url"]) if "visitors" in perm_info["allowed"]: - unprotected_urls.append(url) + if url not in unprotected_urls: + unprotected_urls.append(url) - # Legacy stuff : we remove now unprotected-urls that might have been declared as protected earlier... + # Legacy stuff : we remove now protected-urls that might have been declared as unprotected earlier... protected_urls = [u for u in protected_urls if u != url] else: - # TODO : small optimization to implement : we don't need to explictly add all the app roots - protected_urls.append(url) + if url not in protected_urls: + protected_urls.append(url) - # Legacy stuff : we remove now unprotected-urls that might have been declared as protected earlier... + # Legacy stuff : we remove now unprotected-urls / skipped-urls that might have been declared as protected earlier... unprotected_urls = [u for u in unprotected_urls if u != url] + skipped_urls = [u for u in skipped_urls if u != url] for domain in domains: skipped_urls.extend([domain + '/yunohost/admin', domain + '/yunohost/api'])