From 44b1a245b6857d3eaac4c52e8f06719e475b3660 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 16 Feb 2024 20:34:36 +0100 Subject: [PATCH] fix get role in register_user_dlt --- ereuse_devicehub/modules/dpp/commands/register_user_dlt.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ereuse_devicehub/modules/dpp/commands/register_user_dlt.py b/ereuse_devicehub/modules/dpp/commands/register_user_dlt.py index 63e2e5b5..a40dd0ae 100644 --- a/ereuse_devicehub/modules/dpp/commands/register_user_dlt.py +++ b/ereuse_devicehub/modules/dpp/commands/register_user_dlt.py @@ -57,13 +57,17 @@ class RegisterUserDlt: data_eth = json.dumps(ethereum) user.api_keys_dlt = encrypt(password, data_eth) + lroles = [] try: # TODO Not works with app.app_context(): ses = g.get('session', None) ses["eth_pub_key"] = eth_pub_key attributes = user.get_abac_attributes() - roles = attributes.get("role", ["Operator"]) + for c in attributes: + if 'role' in c.get('attributeURI'): + lrole.append(c.get('attributeValue')) + roles = ",".join(lrole) except Exception: roles = ["Operator"]