diff --git a/examples/membership-card.csv b/examples/membership-card.csv index 5148727..1f4d08d 100644 --- a/examples/membership-card.csv +++ b/examples/membership-card.csv @@ -1,2 +1,2 @@ -name surnames email typeOfPerson membershipType organisation validFrom validUntil identityDocType identityNumber -Pepe Gómez user1@example.org individual Member Pangea 01-01-2023 +name surnames email typeOfPerson membershipType organisation affiliatedSince +Pepe Gómez user1@example.org individual Member Pangea 01-01-2023 diff --git a/idhub/admin/forms.py b/idhub/admin/forms.py index 7b1bbd7..2917932 100644 --- a/idhub/admin/forms.py +++ b/idhub/admin/forms.py @@ -75,8 +75,10 @@ class ImportForm(forms.Form): if not data_pd: self.exception("This file is empty!") + properties = self.json_schema['properties']['credentialSubject']['properties'] + head_row = {x: '' for x in properties.keys()} for n in range(df.last_valid_index()+1): - row = {} + row = head_row.copy() for k in data_pd.keys(): row[k] = data_pd[k][n] or '' diff --git a/idhub/templates/credentials/membership-card.json b/idhub/templates/credentials/membership-card.json index dfa6a79..bc315bb 100644 --- a/idhub/templates/credentials/membership-card.json +++ b/idhub/templates/credentials/membership-card.json @@ -20,6 +20,8 @@ "lang": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/vocab#lang", "surnames": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/vocab#surnames", "email": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/vocab#email", + "affiliatedSince": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/vocab#affiliatedSince", + "affiliatedUntil": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/vocab#affiliatedUntil", "issued": "https://ec.europa.eu/digital-building-blocks/wikis/display/EBSIDOC/Verifiable+Attestation#issued", "validFrom": "https://ec.europa.eu/digital-building-blocks/wikis/display/EBSIDOC/Verifiable+Attestation#validFrom", "validUntil": "https://ec.europa.eu/digital-building-blocks/wikis/display/EBSIDOC/Verifiable+Attestation#validUntil" @@ -87,9 +89,11 @@ "organisation": "Pangea", "membershipType": "{{ membershipType }}", "membershipId": "{{ vc_id }}", - "AffiliatedFrom": "{{ AffiliatedFrom }}", - "AffiliatedUntil": "{{ AffiliatedUntil }}", + "affiliatedSince": "{{ affiliatedSince }}", + "affiliatedUntil": "{{ affiliatedUntil }}", "typeOfPerson": "{{ typeOfPerson }}", + "identityDocType": "{{ identityDocType }}", + "identityNumber": "{{ identityNumber }}", "name": "{{ first_name }}", "surnames": "{{ last_name }}", "email": "{{ email }}", diff --git a/idhub/user/forms.py b/idhub/user/forms.py index 173f3a8..53a1149 100644 --- a/idhub/user/forms.py +++ b/idhub/user/forms.py @@ -44,7 +44,10 @@ class RequestCredentialForm(forms.Form): did = did[0].did cred = cred[0] - cred.issue(did) + try: + cred.issue(did) + except Exception: + return if commit: cred.save() diff --git a/schemas/membership-card.json b/schemas/membership-card.json index dcaa00d..0d5ff9a 100644 --- a/schemas/membership-card.json +++ b/schemas/membership-card.json @@ -14,11 +14,11 @@ "membershipType": { "type": "string" }, - "AffiliatedFrom": { + "affiliatedSince": { "type": "string", "format": "date-time" }, - "AffiliatedUntil": { + "affiliatedUntil": { "type": "string", "format": "date-time" }, @@ -54,6 +54,7 @@ }, "required": [ "organisation", + "affiliatedSince", "typeOfPerson", "name", "surnames",