From 87e3c3e9179dddfa959f0d8d62927b4e313c511c Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 23 Jan 2024 18:38:34 +0100 Subject: [PATCH] fix --- .../modules/dpp/commands/register_user_dlt.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ereuse_devicehub/modules/dpp/commands/register_user_dlt.py b/ereuse_devicehub/modules/dpp/commands/register_user_dlt.py index e67c7d73..2b334cf1 100644 --- a/ereuse_devicehub/modules/dpp/commands/register_user_dlt.py +++ b/ereuse_devicehub/modules/dpp/commands/register_user_dlt.py @@ -2,7 +2,7 @@ import json import click -from flask import current_app as app +from flask import g, current_app as app from ereuseapi.methods import register_user from ereuse_devicehub.db import db from ereuse_devicehub.resources.user.models import User @@ -59,10 +59,14 @@ class RegisterUserDlt: user.api_keys_dlt = encrypt(password, data_eth) try: - attributes = user.get_abac_attributes() - roles = attributes.get("role", ["Operator"]) + # 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"]) except Exception: - roles ["Operator"] + roles = ["Operator"] user.rols_dlt = json.dumps(roles)