From 95700e7ba420ef320e806c99e390de0ddcf4d127 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 5 Feb 2024 14:54:00 +0100 Subject: [PATCH] comment set rols for users --- .../modules/dpp/scripts/register_user_dlt.py | 15 +++++----- ereuse_devicehub/modules/dpp/users.py | 2 +- ereuse_devicehub/resources/user/models.py | 29 ++++++++++--------- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/ereuse_devicehub/modules/dpp/scripts/register_user_dlt.py b/ereuse_devicehub/modules/dpp/scripts/register_user_dlt.py index d7b7ab41..54aa564a 100644 --- a/ereuse_devicehub/modules/dpp/scripts/register_user_dlt.py +++ b/ereuse_devicehub/modules/dpp/scripts/register_user_dlt.py @@ -8,12 +8,13 @@ def register_user(email, password, rols="Operator"): # rols = 'Issuer, Operator, Witness, Verifier' user = User.query.filter_by(email=email).one() - token_dlt = user.set_new_dlt_keys(password) - result = user.allow_permitions(api_token=token_dlt, rols=rols) - rols = user.get_rols(token_dlt=token_dlt) - rols = [k for k, v in rols] - user.rols_dlt = json.dumps(rols) + # token_dlt = user.set_new_dlt_keys(password) + # result = user.allow_permitions(api_token=token_dlt, rols=rols) + # rols = user.get_rols(token_dlt=token_dlt) + # rols = [k for k, v in rols] + # user.rols_dlt = json.dumps(rols) - db.session.commit() + # db.session.commit() - return result, rols + # return result, rols + return diff --git a/ereuse_devicehub/modules/dpp/users.py b/ereuse_devicehub/modules/dpp/users.py index 47bc9982..5c7e2e85 100644 --- a/ereuse_devicehub/modules/dpp/users.py +++ b/ereuse_devicehub/modules/dpp/users.py @@ -5,5 +5,5 @@ from ereuse_devicehub.resources.user.models import User def set_dlt_user(email, password): u = User.query.filter_by(email=email).one() api_token = u.set_new_dlt_keys(password) - u.allow_permitions(api_token) + # u.allow_permitions(api_token) db.session.commit() diff --git a/ereuse_devicehub/resources/user/models.py b/ereuse_devicehub/resources/user/models.py index b675c43e..2ead8600 100644 --- a/ereuse_devicehub/resources/user/models.py +++ b/ereuse_devicehub/resources/user/models.py @@ -140,22 +140,25 @@ class User(UserMixin, Thing): self.api_keys_dlt = encrypt(password, data) def allow_permitions(self, api_token=None, rols="Operator"): - if 'dpp' not in app.blueprints.keys(): - return + # Is discontinued over IOTA branch + return + + # if 'dpp' not in app.blueprints.keys(): + # return - if not api_token: - api_token = session.get('token_dlt', '.') - target_user = api_token.split(".")[0] - keyUser1 = app.config.get('API_DLT_TOKEN') - api_dlt = app.config.get('API_DLT') - if not keyUser1 or not api_dlt: - return + # if not api_token: + # api_token = session.get('token_dlt', '.') + # target_user = api_token.split(".")[0] + # keyUser1 = app.config.get('API_DLT_TOKEN') + # api_dlt = app.config.get('API_DLT') + # if not keyUser1 or not api_dlt: + # return - apiUser1 = API(api_dlt, keyUser1, "ethereum") + # apiUser1 = API(api_dlt, keyUser1, "ethereum") - for rol in rols.split(","): - result = apiUser1.issue_credential(rol.strip(), target_user) - return result + # for rol in rols.split(","): + # result = apiUser1.issue_credential(rol.strip(), target_user) + # return result def get_rols_dlt(self): return json.loads(self.rols_dlt)