From 49d19ec38e6e90ef1c4b30762780fbe456507a3b Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 2 Jun 2023 11:42:38 +0200 Subject: [PATCH] add dpp --- ereuse_devicehub/did/views.py | 2 +- ereuse_devicehub/forms.py | 4 ++-- ereuse_devicehub/resources/action/models.py | 4 ++-- ereuse_devicehub/resources/device/models.py | 2 +- ereuse_devicehub/resources/device/views.py | 2 +- ereuse_devicehub/resources/user/models.py | 16 ++++++++-------- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ereuse_devicehub/did/views.py b/ereuse_devicehub/did/views.py index b0d0cd8d..b902ddd8 100644 --- a/ereuse_devicehub/did/views.py +++ b/ereuse_devicehub/did/views.py @@ -62,7 +62,7 @@ class DidView(View): if rols: self.context['rols'] = rols - if 'trublo' not in app.blueprints.keys(): + if 'dpp' not in app.blueprints.keys(): return [] if not session.get('token_dlt'): diff --git a/ereuse_devicehub/forms.py b/ereuse_devicehub/forms.py index 2e81254a..5f40ca2d 100644 --- a/ereuse_devicehub/forms.py +++ b/ereuse_devicehub/forms.py @@ -69,7 +69,7 @@ class LoginForm(FlaskForm): if not user.is_active: self.form_errors.append(self.error_messages['inactive']) - if 'trublo' in app.blueprints.keys(): + if 'dpp' in app.blueprints.keys(): token_dlt = ( user.get_dlt_keys(self.password.data).get('data', {}).get('api_token') ) @@ -111,7 +111,7 @@ class PasswordForm(FlaskForm): return True def save(self, commit=True): - if 'trublo' not in app.blueprints.keys(): + if 'dpp' not in app.blueprints.keys(): keys_dlt = g.user.get_dlt_keys(self.password.data) g.user.reset_dlt_keys(self.newpassword.data, keys_dlt) diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index 822387bc..c5c806f3 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -496,7 +496,7 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice): def register_proof(self): """This method is used for register a proof of erasure en dlt""" - if 'trublo' not in app.blueprints.keys() or not self.snapshot: + if 'dpp' not in app.blueprints.keys() or not self.snapshot: return if not session.get('token_dlt'): @@ -875,7 +875,7 @@ class Snapshot(JoinedWithOneDeviceMixin, ActionWithOneDevice): return snapshots and 'update' or 'new_device' def register_passport_dlt(self): - if 'trublo' not in app.blueprints.keys() or not self.device.hid: + if 'dpp' not in app.blueprints.keys() or not self.device.hid: return from ereuse_devicehub.resources.did.models import Dpp diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index e7538809..0c1d32a4 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -934,7 +934,7 @@ class Device(Thing): return types.get(self.type, '') def register_dlt(self): - if 'trublo' not in app.blueprints.keys() or not self.hid: + if 'dpp' not in app.blueprints.keys() or not self.hid: return if not session.get('token_dlt'): diff --git a/ereuse_devicehub/resources/device/views.py b/ereuse_devicehub/resources/device/views.py index 8b467051..96a6e91b 100644 --- a/ereuse_devicehub/resources/device/views.py +++ b/ereuse_devicehub/resources/device/views.py @@ -141,7 +141,7 @@ class DeviceView(View): if rols: return [(k, k) for k in rols] - if 'trublo' not in app.blueprints.keys(): + if 'dpp' not in app.blueprints.keys(): return [] if not session.get('token_dlt'): diff --git a/ereuse_devicehub/resources/user/models.py b/ereuse_devicehub/resources/user/models.py index e4ac662a..fee89686 100644 --- a/ereuse_devicehub/resources/user/models.py +++ b/ereuse_devicehub/resources/user/models.py @@ -102,12 +102,12 @@ class User(UserMixin, Thing): return self.password == password def set_new_dlt_keys(self, password): - if 'trublo' not in app.blueprints.keys(): + if 'dpp' not in app.blueprints.keys(): return from ereuseapi.methods import register_user - from ereuse_devicehub.modules.trublo.utils import encrypt + from ereuse_devicehub.modules.dpp.utils import encrypt api_dlt = app.config.get('API_DLT') data = register_user(api_dlt) @@ -117,10 +117,10 @@ class User(UserMixin, Thing): return api_token def get_dlt_keys(self, password): - if 'trublo' not in app.blueprints.keys(): + if 'dpp' not in app.blueprints.keys(): return {} - from ereuse_devicehub.modules.trublo.utils import decrypt + from ereuse_devicehub.modules.dpp.utils import decrypt if not self.api_keys_dlt: return {} @@ -129,16 +129,16 @@ class User(UserMixin, Thing): return json.loads(data) def reset_dlt_keys(self, password, data): - if 'trublo' not in app.blueprints.keys(): + if 'dpp' not in app.blueprints.keys(): return - from ereuse_devicehub.modules.trublo.utils import encrypt + from ereuse_devicehub.modules.dpp.utils import encrypt data = json.dumps(data) self.api_keys_dlt = encrypt(password, data) def allow_permitions(self, api_token=None): - if 'trublo' not in app.blueprints.keys(): + if 'dpp' not in app.blueprints.keys(): return if not api_token: @@ -158,7 +158,7 @@ class User(UserMixin, Thing): if session.get('rols'): return session.get('rols') - if 'trublo' not in app.blueprints.keys(): + if 'dpp' not in app.blueprints.keys(): return [] if not session.get('token_dlt'):