From 31192aac5628c4e7194150fcce1734e8b6a1308f Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 6 Jun 2024 14:16:38 +0200 Subject: [PATCH] clean spaces --- idhub/models.py | 66 ++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/idhub/models.py b/idhub/models.py index 3ac79e2..e68c905 100644 --- a/idhub/models.py +++ b/idhub/models.py @@ -96,7 +96,7 @@ class Event(models.Model): message=msg, user=user ) - + # Is required? @classmethod def set_EV_DATA_UPDATE_REQUESTED_BY_USER(cls, user): @@ -107,7 +107,7 @@ class Event(models.Model): type=cls.Types.EV_DATA_UPDATE_REQUESTED_BY_USER, message=msg, ) - + # Is required? @classmethod def set_EV_DATA_UPDATE_REQUESTED(cls, user): @@ -118,7 +118,7 @@ class Event(models.Model): message=msg, user=user ) - + @classmethod def set_EV_USR_UPDATED_BY_ADMIN(cls, user): msg = "The admin has updated the following user 's information: " @@ -145,7 +145,7 @@ class Event(models.Model): message=msg, user=user ) - + @classmethod def set_EV_USR_DELETED_BY_ADMIN(cls, user): msg = _("The admin has deleted the user: username: {username}").format( @@ -155,7 +155,7 @@ class Event(models.Model): type=cls.Types.EV_USR_DELETED_BY_ADMIN, message=msg ) - + @classmethod def set_EV_DID_CREATED_BY_USER(cls, did): msg = _("New DID with DID-ID: '{did}' created by user '{username}'").format( @@ -166,7 +166,7 @@ class Event(models.Model): type=cls.Types.EV_DID_CREATED_BY_USER, message=msg, ) - + @classmethod def set_EV_DID_CREATED(cls, did): msg = _("New DID with label: '{label}' and DID-ID: '{did}' was created'").format( @@ -178,10 +178,10 @@ class Event(models.Model): message=msg, user=did.user ) - + @classmethod def set_EV_DID_DELETED(cls, did): - msg = _("The DID with label '{label}' and DID-ID: '{did}' was deleted from your wallet").format( + msg = _("The DID with label '{label}' and DID-ID: '{did}' was deleted from your wallet").format( label=did.label, did=did.did ) @@ -190,7 +190,7 @@ class Event(models.Model): message=msg, user=did.user ) - + @classmethod def set_EV_CREDENTIAL_DELETED_BY_ADMIN(cls, cred): msg = _("The credential of type '{type}' and ID: '{id}' was deleted").format( @@ -201,7 +201,7 @@ class Event(models.Model): type=cls.Types.EV_CREDENTIAL_DELETED_BY_ADMIN, message=msg, ) - + @classmethod def set_EV_CREDENTIAL_DELETED(cls, cred): msg = _("The credential of type '{type}' and ID: '{id}' was deleted from your wallet").format( @@ -213,7 +213,7 @@ class Event(models.Model): message=msg, user=cred.user ) - + @classmethod def set_EV_CREDENTIAL_ISSUED_FOR_USER(cls, cred): msg = _("The credential of type '{type}' and ID: '{id}' was issued for user {username}").format( @@ -225,7 +225,7 @@ class Event(models.Model): type=cls.Types.EV_CREDENTIAL_ISSUED_FOR_USER, message=msg, ) - + @classmethod def set_EV_CREDENTIAL_ISSUED(cls, cred): msg = _("The credential of type '{type}' and ID: '{id}' was issued and stored in your wallet").format( @@ -237,7 +237,7 @@ class Event(models.Model): message=msg, user=cred.user ) - + @classmethod def set_EV_CREDENTIAL_PRESENTED_BY_USER(cls, cred, verifier): msg = "The credential of type '{type}' and ID: '{id}' " @@ -252,7 +252,7 @@ class Event(models.Model): type=cls.Types.EV_CREDENTIAL_PRESENTED_BY_USER, message=msg, ) - + @classmethod def set_EV_CREDENTIAL_PRESENTED(cls, cred, verifier): msg = "The credential of type '{type}' and ID: '{id}' " @@ -267,7 +267,7 @@ class Event(models.Model): message=msg, user=cred.user ) - + @classmethod def set_EV_CREDENTIAL_ENABLED(cls, cred): msg = _("The credential of type '{type}' was enabled for user {username}").format( @@ -278,7 +278,7 @@ class Event(models.Model): type=cls.Types.EV_CREDENTIAL_ENABLED, message=msg, ) - + @classmethod def set_EV_CREDENTIAL_CAN_BE_REQUESTED(cls, cred): msg = _("You can request the '{type}' credential").format( @@ -289,7 +289,7 @@ class Event(models.Model): message=msg, user=cred.user ) - + @classmethod def set_EV_CREDENTIAL_REVOKED_BY_ADMIN(cls, cred): msg = _("The credential of type '{type}' and ID: '{id}' was revoked for ").format( @@ -300,7 +300,7 @@ class Event(models.Model): type=cls.Types.EV_CREDENTIAL_REVOKED_BY_ADMIN, message=msg, ) - + @classmethod def set_EV_CREDENTIAL_REVOKED(cls, cred): msg = _("The credential of type '{type}' and ID: '{id}' was revoked by admin").format( @@ -312,7 +312,7 @@ class Event(models.Model): message=msg, user=cred.user ) - + @classmethod def set_EV_ROLE_CREATED_BY_ADMIN(cls): msg = _('A new role was created by admin') @@ -320,7 +320,7 @@ class Event(models.Model): type=cls.Types.EV_ROLE_CREATED_BY_ADMIN, message=msg, ) - + @classmethod def set_EV_ROLE_MODIFIED_BY_ADMIN(cls): msg = _('The role was modified by admin') @@ -328,7 +328,7 @@ class Event(models.Model): type=cls.Types.EV_ROLE_MODIFIED_BY_ADMIN, message=msg, ) - + @classmethod def set_EV_ROLE_DELETED_BY_ADMIN(cls): msg = _('The role was removed by admin') @@ -336,7 +336,7 @@ class Event(models.Model): type=cls.Types.EV_ROLE_DELETED_BY_ADMIN, message=msg, ) - + @classmethod def set_EV_SERVICE_CREATED_BY_ADMIN(cls): msg = _('A new service was created by admin') @@ -344,7 +344,7 @@ class Event(models.Model): type=cls.Types.EV_SERVICE_CREATED_BY_ADMIN, message=msg, ) - + @classmethod def set_EV_SERVICE_MODIFIED_BY_ADMIN(cls): msg = _('The service was modified by admin') @@ -352,7 +352,7 @@ class Event(models.Model): type=cls.Types.EV_SERVICE_MODIFIED_BY_ADMIN, message=msg, ) - + @classmethod def set_EV_SERVICE_DELETED_BY_ADMIN(cls): msg = _('The service was removed by admin') @@ -360,7 +360,7 @@ class Event(models.Model): type=cls.Types.EV_SERVICE_DELETED_BY_ADMIN, message=msg, ) - + @classmethod def set_EV_ORG_DID_CREATED_BY_ADMIN(cls, did): msg = _("New Organisational DID with label: '{label}' and DID-ID: '{did}' was created").format( @@ -371,7 +371,7 @@ class Event(models.Model): type=cls.Types.EV_ORG_DID_CREATED_BY_ADMIN, message=msg, ) - + @classmethod def set_EV_ORG_DID_DELETED_BY_ADMIN(cls, did): msg = _("Organisational DID with label: '{label}' and DID-ID: '{did}' was removed").format( @@ -382,7 +382,7 @@ class Event(models.Model): type=cls.Types.EV_ORG_DID_DELETED_BY_ADMIN, message=msg, ) - + @classmethod def set_EV_USR_DEACTIVATED_BY_ADMIN(cls, user): msg = "The user '{username}' was temporarily deactivated: " @@ -396,7 +396,7 @@ class Event(models.Model): type=cls.Types.EV_USR_DEACTIVATED_BY_ADMIN, message=msg, ) - + @classmethod def set_EV_USR_ACTIVATED_BY_ADMIN(cls, user): msg = "The user '{username}' was activated: " @@ -418,7 +418,7 @@ class Event(models.Model): message=msg, user=user ) - + @classmethod def set_EV_USR_SEND_CREDENTIAL(cls, msg): cls.objects.create( @@ -468,7 +468,7 @@ class DID(models.Model): user.set_encrypted_sensitive_data() user.save() self.key_material = user.encrypt_data(value) - + def set_did(self): new_key_material = generate_keys() self.set_key_material(new_key_material) @@ -772,7 +772,7 @@ class VerificableCredential(models.Model): tmpl = get_template(template_name) d = json.loads(tmpl.render({})) self.type = d.get('type')[-1] - + def filter_dict(self, dic): new_dict = OrderedDict() @@ -799,7 +799,7 @@ class File_datas(models.Model): class Membership(models.Model): """ - This model represent the relation of this user with the ecosystem. + This model represent the relation of this user with the ecosystem. """ class Types(models.IntegerChoices): BENEFICIARY = 1, _('Beneficiary') @@ -849,7 +849,7 @@ class Service(models.Model): if self.rol.exists(): return ", ".join([x.name for x in self.rol.order_by("name")]) return _("None") - + def __str__(self): return "{} -> {}".format(self.domain, self.get_roles())