From 91aafe7d4264846e76649cfdd1071c2a6d5a118c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Tue, 31 Mar 2020 10:47:44 +0200 Subject: [PATCH] Rework remove_sso_conf script --- conf/remove_sso_conf.py | 13 ++++++------- scripts/remove | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/conf/remove_sso_conf.py b/conf/remove_sso_conf.py index cc24cbf..d381dd4 100644 --- a/conf/remove_sso_conf.py +++ b/conf/remove_sso_conf.py @@ -1,15 +1,14 @@ import json +domain = sys.argv[1] +server_name = sys.argv[2] + with open("/etc/ssowat/conf.json.persistent", "r", encoding='utf-8') as jsonFile: data = json.load(jsonFile) - for entry in data["skipped_urls"].copy(): - if "/_matrix" in entry or "/.well-known/matrix/" in entry: - data["skipped_urls"].remove(entry) - - for entry in data["protected_urls"].copy(): - if "/_matrix" in entry: - data["protected_urls"].remove(entry) + data["skipped_urls"].remove(domain + "/_matrix") + data["skipped_urls"].remove(server_name + "/.well-known/matrix/") + data["protected_urls"].remove(domain + "/_matrix/cas_server.php/login") with open("/etc/ssowat/conf.json.persistent", "w", encoding='utf-8') as jsonFile: jsonFile.write(json.dumps(data, indent=4, sort_keys=True)) diff --git a/scripts/remove b/scripts/remove index ce230b8..b2d3936 100755 --- a/scripts/remove +++ b/scripts/remove @@ -80,7 +80,7 @@ ynh_remove_app_dependencies #================================================= # Remove the skipped url -python3 ../conf/remove_sso_conf.py +python3 ../conf/remove_sso_conf.py $domain $server_name #================================================= # REMOVE APP MAIN DIR