From c9238e8e6ab5c80de1fd76313c2a4ae761c2972d Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 23 Jan 2024 18:08:16 +0100 Subject: [PATCH] get ABAC_URL from config in user model --- ereuse_devicehub/resources/user/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/resources/user/models.py b/ereuse_devicehub/resources/user/models.py index a2ea060f..f7a20ad6 100644 --- a/ereuse_devicehub/resources/user/models.py +++ b/ereuse_devicehub/resources/user/models.py @@ -195,16 +195,17 @@ class User(UserMixin, Thing): def _call_abac(self, path): abac_tk = app.config.get('ABAC_TOKEN') abac_coockie = app.config.get('ABAC_COOKIE') + domain = app.config.get('ABAC_URL') eth_pub_key = session.get('eth_pub_key') + abac_path = path - if not (abac_tk and eth_pub_key and abac_path): + if not (abac_tk and eth_pub_key and abac_path and domain): return '' header = { 'Authorization': f'Bearer {abac_tk}', 'Cookie': abac_coockie } - domain = 'https://abac-oracle.stable.iota-ec.net/accounts/' url = f'{domain}{eth_pub_key}/{abac_path}' return requests.get(url, headers=header)