fix get role in register_user_dlt

This commit is contained in:
Cayo Puigdefabregas 2024-02-16 20:34:36 +01:00
parent f9ec594a0e
commit 44b1a245b6

View file

@ -57,13 +57,17 @@ class RegisterUserDlt:
data_eth = json.dumps(ethereum) data_eth = json.dumps(ethereum)
user.api_keys_dlt = encrypt(password, data_eth) user.api_keys_dlt = encrypt(password, data_eth)
lroles = []
try: try:
# TODO Not works # TODO Not works
with app.app_context(): with app.app_context():
ses = g.get('session', None) ses = g.get('session', None)
ses["eth_pub_key"] = eth_pub_key ses["eth_pub_key"] = eth_pub_key
attributes = user.get_abac_attributes() 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: except Exception:
roles = ["Operator"] roles = ["Operator"]