diff --git a/idhub/admin/forms.py b/idhub/admin/forms.py index 83c167c..8ff83b5 100644 --- a/idhub/admin/forms.py +++ b/idhub/admin/forms.py @@ -1,15 +1,18 @@ import csv import json -import copy import pandas as pd from jsonschema import validate from django import forms +from django.utils.translation import gettext_lazy as _ from django.core.exceptions import ValidationError from idhub.models import ( DID, - File_datas, + File_datas, + Membership, Schemas, + Service, + UserRol, VerificableCredential, ) from idhub_auth.models import User @@ -104,14 +107,14 @@ class ImportForm(forms.Form): user = User.objects.filter(email=row.get('email')) if not user: - txt = _('The user not exist!') + txt = _('The user does not exist!') msg = "line {}: {}".format(line+1, txt) self.exception(msg) return user.first() def create_credential(self, user, row): - d = copy.copy(self.json_schema) + d = self.json_schema.copy() d['instance'] = row return VerificableCredential( verified=False, @@ -126,3 +129,65 @@ class ImportForm(forms.Form): class SchemaForm(forms.Form): file_template = forms.FileField() + + +class MembershipForm(forms.ModelForm): + + class Meta: + model = Membership + fields = ['type', 'start_date', 'end_date'] + + def clean_end_date(self): + data = super().clean() + start_date = data['start_date'] + end_date = data.get('end_date') + members = Membership.objects.filter( + type=data['type'], + user=self.instance.user + ) + if self.instance.id: + members = members.exclude(id=self.instance.id) + + if (start_date and end_date): + if start_date > end_date: + msg = _("The end date is less than the start date") + raise forms.ValidationError(msg) + + members = members.filter( + start_date__lte=end_date, + end_date__gte=start_date, + ) + + if members.exists(): + msg = _("This membership already exists!") + raise forms.ValidationError(msg) + + return end_date + + +class UserRolForm(forms.ModelForm): + + class Meta: + model = UserRol + fields = ['service'] + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + if not self.instance.id: + user = self.instance.user + choices = self.fields['service'].choices + choices.queryset = choices.queryset.exclude(users__user=user) + self.fields['service'].choices = choices + + def clean_service(self): + data = super().clean() + service = UserRol.objects.filter( + service=data['service'], + user=self.instance.user + ) + + if service.exists(): + msg = _("Is not possible to have a duplicate role") + raise forms.ValidationError(msg) + + return data['service'] diff --git a/idhub/admin/views.py b/idhub/admin/views.py index 786b0be..6ee837b 100644 --- a/idhub/admin/views.py +++ b/idhub/admin/views.py @@ -1,6 +1,5 @@ import os import json -import copy import logging import pandas as pd from pathlib import Path @@ -22,11 +21,18 @@ from django.http import HttpResponse from django.contrib import messages from utils import credtools from idhub_auth.models import User +from idhub_auth.forms import ProfileForm from idhub.mixins import AdminView from idhub.email.views import NotifyActivateUserByEmail -from idhub.admin.forms import ImportForm, SchemaForm +from idhub.admin.forms import ( + ImportForm, + MembershipForm, + SchemaForm, + UserRolForm, +) from idhub.models import ( DID, + Event, File_datas, Membership, Rol, @@ -44,34 +50,41 @@ class DashboardView(AdminView, TemplateView): icon = 'bi bi-bell' section = "Home" + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context.update({ + 'events': Event.objects.filter(user=None), + }) + return context + class People(AdminView): - title = _("People Management") + title = _("User Management") section = "People" class AccessControl(AdminView, TemplateView): - title = _("Access Control Management") + title = _("Access control management") section = "AccessControl" class Credentials(AdminView, TemplateView): - title = _("Credentials Management") - section = "Credentials" + title = _("Credential Management") + section = "Credential" class SchemasMix(AdminView, TemplateView): - title = _("Templates Management") - section = "Templates" + title = _("Template Management") + section = "Template" class ImportExport(AdminView): - title = _("Massive Data Management") + title = _("Data file management") section = "ImportExport" class PeopleListView(People, TemplateView): template_name = "idhub/admin/people.html" - subtitle = _('People list') + subtitle = _('View users') icon = 'bi bi-person' def get_context_data(self, **kwargs): @@ -84,7 +97,7 @@ class PeopleListView(People, TemplateView): class PeopleView(People, TemplateView): template_name = "idhub/admin/user.html" - subtitle = _('User Profile') + subtitle = _('User personal information') icon = 'bi bi-person' model = User @@ -113,8 +126,10 @@ class PeopleActivateView(PeopleView): if self.object.is_active: self.object.is_active = False + Event.set_EV_USR_DEACTIVATED_BY_ADMIN(self.object) else: self.object.is_active = True + Event.set_EV_USR_ACTIVATED_BY_ADMIN(self.object) self.object.save() return redirect('idhub:admin_people', self.object.id) @@ -127,24 +142,57 @@ class PeopleDeleteView(PeopleView): self.object = get_object_or_404(self.model, pk=self.pk) if self.object != self.request.user: + Event.set_EV_USR_DELETED_BY_ADMIN(self.object) self.object.delete() else: messages.error(self.request, _('Is not possible delete your account!')) return redirect('idhub:admin_people_list') -class PeopleEditView(PeopleView, UpdateView): + +class PeopleEditView(People, FormView): template_name = "idhub/admin/user_edit.html" - fields = ('first_name', 'last_name', 'email') + subtitle = _('Update user') + icon = 'bi bi-person' + form_class = ProfileForm success_url = reverse_lazy('idhub:admin_people_list') + def get(self, request, *args, **kwargs): + self.pk = kwargs['pk'] + self.user = get_object_or_404(User, pk=self.pk) + return super().get(request, *args, **kwargs) + + def post(self, request, *args, **kwargs): + self.pk = kwargs['pk'] + self.user = get_object_or_404(User, pk=self.pk) + return super().post(request, *args, **kwargs) + + def get_form_kwargs(self): + kwargs = super().get_form_kwargs() + kwargs['instance'] = self.user + return kwargs + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context.update({ + 'object': self.user, + }) + return context + + def form_valid(self, form): + user = form.save() + messages.success(self.request, _('The account is updated successfully')) + Event.set_EV_USR_UPDATED_BY_ADMIN(user) + Event.set_EV_USR_UPDATED(user) + + return super().form_valid(form) + class PeopleRegisterView(NotifyActivateUserByEmail, People, CreateView): template_name = "idhub/admin/people_register.html" - subtitle = _('People Register') + subtitle = _('Add user') icon = 'bi bi-person' - model = User - fields = ('first_name', 'last_name', 'email') + form_class = ProfileForm success_url = reverse_lazy('idhub:admin_people_list') def get_success_url(self): @@ -156,7 +204,10 @@ class PeopleRegisterView(NotifyActivateUserByEmail, People, CreateView): def form_valid(self, form): user = form.save() - messages.success(self.request, _('The account is created successfully')) + messages.success(self.request, _('The account was created successfully')) + Event.set_EV_USR_REGISTERED(user) + Event.set_EV_USR_WELCOME(user) + if user.is_active: try: self.send_email(user) @@ -165,12 +216,12 @@ class PeopleRegisterView(NotifyActivateUserByEmail, People, CreateView): return super().form_valid(form) -class PeopleMembershipRegisterView(People, CreateView): +class PeopleMembershipRegisterView(People, FormView): template_name = "idhub/admin/people_membership_register.html" - subtitle = _('People add membership') + subtitle = _('Associate a membership to the user') icon = 'bi bi-person' + form_class = MembershipForm model = Membership - fields = ('type', 'start_date', 'end_date') success_url = reverse_lazy('idhub:admin_people_list') def get(self, request, *args, **kwargs): @@ -187,12 +238,19 @@ class PeopleMembershipRegisterView(People, CreateView): form = super().get_form() form.fields['start_date'].widget.input_type = 'date' form.fields['end_date'].widget.input_type = 'date' + form.fields['start_date'].required = True return form def get_form_kwargs(self): self.object = self.model(user=self.user) kwargs = super().get_form_kwargs() + kwargs['instance'] = self.object return kwargs + + def form_valid(self, form): + form.save() + messages.success(self.request, _('Membership created successfully')) + return super().form_valid(form) def get_success_url(self): self.success_url = reverse_lazy( @@ -202,27 +260,43 @@ class PeopleMembershipRegisterView(People, CreateView): return self.success_url -class PeopleMembershipEditView(People, CreateView): +class PeopleMembershipEditView(People, FormView): template_name = "idhub/admin/people_membership_register.html" - subtitle = _('People add membership') + subtitle = _('Associate a membership to the user') icon = 'bi bi-person' + form_class = MembershipForm model = Membership - fields = ('type', 'start_date', 'end_date') success_url = reverse_lazy('idhub:admin_people_list') + def get(self, request, *args, **kwargs): + self.pk = kwargs['pk'] + self.object = get_object_or_404(self.model, pk=self.pk) + self.user = self.object.user + return super().get(request, *args, **kwargs) + + def post(self, request, *args, **kwargs): + self.pk = kwargs['pk'] + self.object = get_object_or_404(self.model, pk=self.pk) + self.user = self.object.user + return super().post(request, *args, **kwargs) + def get_form(self): form = super().get_form() form.fields['start_date'].widget.input_type = 'date' form.fields['end_date'].widget.input_type = 'date' + form.fields['start_date'].required = True return form def get_form_kwargs(self): - pk = self.kwargs.get('pk') - if pk: - self.object = get_object_or_404(self.model, pk=pk) kwargs = super().get_form_kwargs() + kwargs['instance'] = self.object return kwargs + def form_valid(self, form): + form.save() + messages.success(self.request, _('Membership updated successfully')) + return super().form_valid(form) + class PeopleMembershipDeleteView(PeopleView): model = Membership @@ -240,12 +314,12 @@ class PeopleMembershipDeleteView(PeopleView): return redirect('idhub:admin_people_edit', user.id) -class PeopleRolRegisterView(People, CreateView): +class PeopleRolRegisterView(People, FormView): template_name = "idhub/admin/people_rol_register.html" - subtitle = _('Add Rol to User') + subtitle = _('Add a user role to access a service') icon = 'bi bi-person' + form_class = UserRolForm model = UserRol - fields = ('service',) def get(self, request, *args, **kwargs): self.pk = kwargs['pk'] @@ -260,8 +334,14 @@ class PeopleRolRegisterView(People, CreateView): def get_form_kwargs(self): self.object = self.model(user=self.user) kwargs = super().get_form_kwargs() + kwargs['instance'] = self.object return kwargs + def form_valid(self, form): + form.save() + messages.success(self.request, _('Membership created successfully')) + return super().form_valid(form) + def get_success_url(self): self.success_url = reverse_lazy( 'idhub:admin_people_edit', @@ -270,20 +350,33 @@ class PeopleRolRegisterView(People, CreateView): return self.success_url -class PeopleRolEditView(People, CreateView): +class PeopleRolEditView(People, FormView): template_name = "idhub/admin/people_rol_register.html" - subtitle = _('Edit Rol to User') + subtitle = _('Modify a user role to access a service') icon = 'bi bi-person' + form_class = UserRolForm model = UserRol - fields = ('service',) + + def get(self, request, *args, **kwargs): + self.pk = kwargs['pk'] + self.object = get_object_or_404(self.model, pk=self.pk) + return super().get(request, *args, **kwargs) + + def post(self, request, *args, **kwargs): + self.pk = kwargs['pk'] + self.object = get_object_or_404(self.model, pk=self.pk) + return super().post(request, *args, **kwargs) def get_form_kwargs(self): - pk = self.kwargs.get('pk') - if pk: - self.object = get_object_or_404(self.model, pk=pk) kwargs = super().get_form_kwargs() + kwargs['instance'] = self.object return kwargs + def form_valid(self, form): + form.save() + messages.success(self.request, _('Membership updated successfully')) + return super().form_valid(form) + def get_success_url(self): self.success_url = reverse_lazy( 'idhub:admin_people_edit', @@ -307,7 +400,7 @@ class PeopleRolDeleteView(PeopleView): class RolesView(AccessControl): template_name = "idhub/admin/roles.html" - subtitle = _('Roles Management') + subtitle = _('Manage roles') icon = '' def get_context_data(self, **kwargs): @@ -319,20 +412,26 @@ class RolesView(AccessControl): class RolRegisterView(AccessControl, CreateView): template_name = "idhub/admin/rol_register.html" - subtitle = _('Add Rol') + subtitle = _('Add Role') icon = '' model = Rol - fields = ('name',) + fields = ('name', "description") success_url = reverse_lazy('idhub:admin_roles') object = None + + def form_valid(self, form): + form.save() + messages.success(self.request, _('Role created successfully')) + Event.set_EV_ROLE_CREATED_BY_ADMIN() + return super().form_valid(form) -class RolEditView(AccessControl, CreateView): +class RolEditView(AccessControl, UpdateView): template_name = "idhub/admin/rol_register.html" - subtitle = _('Edit Rol') + subtitle = _('Edit Role') icon = '' model = Rol - fields = ('name',) + fields = ('name', "description") success_url = reverse_lazy('idhub:admin_roles') def get_form_kwargs(self): @@ -341,6 +440,12 @@ class RolEditView(AccessControl, CreateView): self.object = get_object_or_404(self.model, pk=pk) kwargs = super().get_form_kwargs() return kwargs + + def form_valid(self, form): + form.save() + messages.success(self.request, _('Role updated successfully')) + Event.set_EV_ROLE_MODIFIED_BY_ADMIN() + return super().form_valid(form) class RolDeleteView(AccessControl): @@ -351,12 +456,14 @@ class RolDeleteView(AccessControl): self.object = get_object_or_404(self.model, pk=self.pk) self.object.delete() + messages.success(self.request, _('Role deleted successfully')) + Event.set_EV_ROLE_DELETED_BY_ADMIN() return redirect('idhub:admin_roles') class ServicesView(AccessControl): template_name = "idhub/admin/services.html" - subtitle = _('Service Management') + subtitle = _('Manage services') icon = '' def get_context_data(self, **kwargs): @@ -368,17 +475,28 @@ class ServicesView(AccessControl): class ServiceRegisterView(AccessControl, CreateView): template_name = "idhub/admin/service_register.html" - subtitle = _('Add Service') + subtitle = _('Add service') icon = '' model = Service fields = ('domain', 'description', 'rol') success_url = reverse_lazy('idhub:admin_services') object = None + def get_form(self): + form = super().get_form() + form.fields['rol'].required = False + return form + + def form_valid(self, form): + form.save() + messages.success(self.request, _('Service created successfully')) + Event.set_EV_SERVICE_CREATED_BY_ADMIN() + return super().form_valid(form) + -class ServiceEditView(AccessControl, CreateView): +class ServiceEditView(AccessControl, UpdateView): template_name = "idhub/admin/service_register.html" - subtitle = _('Edit Service') + subtitle = _('Modify service') icon = '' model = Service fields = ('domain', 'description', 'rol') @@ -391,6 +509,17 @@ class ServiceEditView(AccessControl, CreateView): kwargs = super().get_form_kwargs() return kwargs + def get_form(self): + form = super().get_form() + form.fields['rol'].required = False + return form + + def form_valid(self, form): + form.save() + messages.success(self.request, _('Service updated successfully')) + Event.set_EV_SERVICE_MODIFIED_BY_ADMIN() + return super().form_valid(form) + class ServiceDeleteView(AccessControl): model = Service @@ -400,12 +529,14 @@ class ServiceDeleteView(AccessControl): self.object = get_object_or_404(self.model, pk=self.pk) self.object.delete() + messages.success(self.request, _('Service deleted successfully')) + Event.set_EV_SERVICE_DELETED_BY_ADMIN() return redirect('idhub:admin_services') class CredentialsView(Credentials): template_name = "idhub/admin/credentials.html" - subtitle = _('Credentials list') + subtitle = _('View credentials') icon = '' def get_context_data(self, **kwargs): @@ -461,6 +592,8 @@ class RevokeCredentialsView(Credentials): self.object.status = VerificableCredential.Status.REVOKED self.object.save() messages.success(self.request, _('Credential revoked successfully')) + Event.set_EV_CREDENTIAL_REVOKED_BY_ADMIN(self.object) + Event.set_EV_CREDENTIAL_REVOKED(self.object) return redirect(self.success_url) @@ -481,13 +614,15 @@ class DeleteCredentialsView(Credentials): if self.object.status in status: self.object.delete() messages.success(self.request, _('Credential deleted successfully')) + Event.set_EV_CREDENTIAL_DELETED(self.object) + Event.set_EV_CREDENTIAL_DELETED_BY_ADMIN(self.object) return redirect(self.success_url) class DidsView(Credentials): template_name = "idhub/admin/dids.html" - subtitle = _('Organization Identities (DID)') + subtitle = _('Manage Identities (DID)') icon = 'bi bi-patch-check-fill' wallet = True @@ -513,6 +648,7 @@ class DidRegisterView(Credentials, CreateView): form.instance.set_did() form.save() messages.success(self.request, _('DID created successfully')) + Event.set_EV_ORG_DID_CREATED_BY_ADMIN(form.instance) return super().form_valid(form) @@ -546,29 +682,29 @@ class DidDeleteView(Credentials, DeleteView): def get(self, request, *args, **kwargs): self.pk = kwargs['pk'] self.object = get_object_or_404(self.model, pk=self.pk) + Event.set_EV_ORG_DID_DELETED_BY_ADMIN(self.object) self.object.delete() messages.success(self.request, _('DID delete successfully')) - return redirect(self.success_url) class WalletCredentialsView(Credentials): template_name = "idhub/admin/wallet_credentials.html" - subtitle = _('Credentials') + subtitle = _('View org. credentials') icon = 'bi bi-patch-check-fill' wallet = True class WalletConfigIssuesView(Credentials): template_name = "idhub/admin/wallet_issues.html" - subtitle = _('Configure Issues') + subtitle = _('Configure credential issuance') icon = 'bi bi-patch-check-fill' wallet = True class SchemasView(SchemasMix): template_name = "idhub/admin/schemas.html" - subtitle = _('Template List') + subtitle = _('View credential templates') icon = '' def get_context_data(self, **kwargs): @@ -602,7 +738,7 @@ class SchemasDownloadView(SchemasMix): class SchemasNewView(SchemasMix): template_name = "idhub/admin/schemas_new.html" - subtitle = _('Upload Template') + subtitle = _('Upload template') icon = '' success_url = reverse_lazy('idhub:admin_schemas') @@ -647,7 +783,7 @@ class SchemasNewView(SchemasMix): class SchemasImportView(SchemasMix): template_name = "idhub/admin/schemas_import.html" - subtitle = _('Import Template') + subtitle = _('Import template') icon = '' def get_context_data(self, **kwargs): @@ -675,7 +811,7 @@ class SchemasImportAddView(SchemasMix): schema = self.create_schema(file_name) if schema: - messages.success(self.request, _("The schema add successfully!")) + messages.success(self.request, _("The schema was added sucessfully")) return redirect('idhub:admin_schemas_import') def create_schema(self, file_name): @@ -700,7 +836,7 @@ class SchemasImportAddView(SchemasMix): class ImportView(ImportExport, TemplateView): template_name = "idhub/admin/import.html" - subtitle = _('Import') + subtitle = _('Import data') icon = '' def get_context_data(self, **kwargs): @@ -737,9 +873,12 @@ class ImportAddView(ImportExport, FormView): return kwargs def form_valid(self, form): - cred = form.save() - if cred: + creds = form.save() + if creds: messages.success(self.request, _("The file import was successfully!")) + for cred in creds: + Event.set_EV_CREDENTIAL_ENABLED(cred) + Event.set_EV_CREDENTIAL_CAN_BE_REQUESTED(cred) else: messages.error(self.request, _("Error importing the file!")) return super().form_valid(form) diff --git a/idhub/migrations/0001_initial.py b/idhub/migrations/0001_initial.py index e62b758..cdd6262 100644 --- a/idhub/migrations/0001_initial.py +++ b/idhub/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.5 on 2023-11-14 14:57 +# Generated by Django 4.2.5 on 2023-11-14 16:48 from django.conf import settings from django.db import migrations, models @@ -63,7 +63,13 @@ class Migration(migrations.Migration): verbose_name='ID', ), ), - ('name', models.CharField(max_length=250)), + ('name', models.CharField(max_length=250, verbose_name='name')), + ( + 'description', + models.CharField( + max_length=250, null=True, verbose_name='Description' + ), + ), ], ), migrations.CreateModel( @@ -95,8 +101,11 @@ class Migration(migrations.Migration): verbose_name='ID', ), ), - ('domain', models.CharField(max_length=250)), - ('description', models.CharField(max_length=250)), + ('domain', models.CharField(max_length=250, verbose_name='Domain')), + ( + 'description', + models.CharField(max_length=250, verbose_name='Description'), + ), ('rol', models.ManyToManyField(to='idhub.rol')), ], ), @@ -131,7 +140,7 @@ class Migration(migrations.Migration): ('id_string', models.CharField(max_length=250)), ('verified', models.BooleanField()), ('created_on', models.DateTimeField(auto_now=True)), - ('issuer_on', models.DateTimeField(null=True)), + ('issued_on', models.DateTimeField(null=True)), ('did_issuer', models.CharField(max_length=250)), ('did_subject', models.CharField(max_length=250)), ('data', models.TextField()), @@ -157,6 +166,141 @@ class Migration(migrations.Migration): ), ], ), + migrations.CreateModel( + name='Membership', + fields=[ + ( + 'id', + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'type', + models.PositiveSmallIntegerField( + choices=[(1, 'Beneficiary'), (2, 'Employee'), (3, 'Member')], + verbose_name='Type of membership', + ), + ), + ( + 'start_date', + models.DateField( + blank=True, + help_text='What date did the membership start?', + null=True, + verbose_name='Start date', + ), + ), + ( + 'end_date', + models.DateField( + blank=True, + help_text='What date will the membership end?', + null=True, + verbose_name='End date', + ), + ), + ( + 'user', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='memberships', + to=settings.AUTH_USER_MODEL, + ), + ), + ], + ), + migrations.CreateModel( + name='Event', + fields=[ + ( + 'id', + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ('created', models.DateTimeField(auto_now=True)), + ('message', models.CharField(max_length=350)), + ( + 'type', + models.PositiveSmallIntegerField( + choices=[ + (1, 'EV_USR_REGISTERED'), + (2, 'EV_USR_WELCOME'), + (3, 'EV_DATA_UPDATE_REQUESTED_BY_USER'), + (4, 'EV_DATA_UPDATE_REQUESTED'), + (5, 'EV_USR_UPDATED_BY_ADMIN'), + (6, 'EV_USR_UPDATED'), + (7, 'EV_USR_DELETED_BY_ADMIN'), + (8, 'EV_DID_CREATED_BY_USER'), + (9, 'EV_DID_CREATED'), + (10, 'EV_DID_DELETED'), + (11, 'EV_CREDENTIAL_DELETED_BY_ADMIN'), + (12, 'EV_CREDENTIAL_DELETED'), + (13, 'EV_CREDENTIAL_ISSUED_FOR_USER'), + (14, 'EV_CREDENTIAL_ISSUED'), + (15, 'EV_CREDENTIAL_PRESENTED_BY_USER'), + (16, 'EV_CREDENTIAL_PRESENTED'), + (17, 'EV_CREDENTIAL_ENABLED'), + (18, 'EV_CREDENTIAL_CAN_BE_REQUESTED'), + (19, 'EV_CREDENTIAL_REVOKED_BY_ADMIN'), + (20, 'EV_CREDENTIAL_REVOKED'), + (21, 'EV_ROLE_CREATED_BY_ADMIN'), + (22, 'EV_ROLE_MODIFIED_BY_ADMIN'), + (23, 'EV_ROLE_DELETED_BY_ADMIN'), + (24, 'EV_SERVICE_CREATED_BY_ADMIN'), + (25, 'EV_SERVICE_MODIFIED_BY_ADMIN'), + (26, 'EV_SERVICE_DELETED_BY_ADMIN'), + (27, 'EV_ORG_DID_CREATED_BY_ADMIN'), + (28, 'EV_ORG_DID_DELETED_BY_ADMIN'), + (29, 'EV_USR_DEACTIVATED_BY_ADMIN'), + (30, 'EV_USR_ACTIVATED_BY_ADMIN'), + ] + ), + ), + ( + 'user', + models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='events', + to=settings.AUTH_USER_MODEL, + ), + ), + ], + ), + migrations.CreateModel( + name='DID', + fields=[ + ( + 'id', + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ('created_at', models.DateTimeField(auto_now=True)), + ('label', models.CharField(max_length=50)), + ('key_material', models.CharField(max_length=250)), + ( + 'user', + models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='dids', + to=settings.AUTH_USER_MODEL, + ), + ), + ], + ), migrations.CreateModel( name='UserRol', fields=[ @@ -186,78 +330,8 @@ class Migration(migrations.Migration): ), ), ], - ), - migrations.CreateModel( - name='Membership', - fields=[ - ( - 'id', - models.BigAutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name='ID', - ), - ), - ( - 'type', - models.PositiveSmallIntegerField( - choices=[(1, 'Beneficiary'), (2, 'Employee'), (3, 'Partner')], - verbose_name='Type of membership', - ), - ), - ( - 'start_date', - models.DateField( - blank=True, - help_text='What date did the membership start?', - null=True, - verbose_name='Start date', - ), - ), - ( - 'end_date', - models.DateField( - blank=True, - help_text='What date did the membership end?', - null=True, - verbose_name='End date', - ), - ), - ( - 'user', - models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, - related_name='memberships', - to=settings.AUTH_USER_MODEL, - ), - ), - ], - ), - migrations.CreateModel( - name='DID', - fields=[ - ( - 'id', - models.BigAutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name='ID', - ), - ), - ('created_at', models.DateTimeField(auto_now=True)), - ('label', models.CharField(max_length=50)), - ('key_material', models.CharField(max_length=250)), - ( - 'user', - models.ForeignKey( - null=True, - on_delete=django.db.models.deletion.CASCADE, - related_name='dids', - to=settings.AUTH_USER_MODEL, - ), - ), - ], + options={ + 'unique_together': {('user', 'service')}, + }, ), ] diff --git a/idhub/models.py b/idhub/models.py index 1c0c8e8..b74f9dc 100644 --- a/idhub/models.py +++ b/idhub/models.py @@ -1,17 +1,399 @@ import json import requests +import datetime from django.db import models from django.utils.translation import gettext_lazy as _ from idhub_ssikit import generate_did_controller_key from idhub_auth.models import User -# class Event(models.Model): - # Para los "audit logs" que se requieren en las pantallas. - # timestamp = models.DateTimeField() - # Los eventos no tienen relaciĆ³n con otros objetos a nivel de BBDD. - # event_data = models.CharField(max_length=250) +class Event(models.Model): + class Types(models.IntegerChoices): + EV_USR_REGISTERED = 1, "EV_USR_REGISTERED" + EV_USR_WELCOME = 2, "EV_USR_WELCOME" + EV_DATA_UPDATE_REQUESTED_BY_USER = 3, "EV_DATA_UPDATE_REQUESTED_BY_USER" + EV_DATA_UPDATE_REQUESTED = 4, "EV_DATA_UPDATE_REQUESTED" + EV_USR_UPDATED_BY_ADMIN = 5, "EV_USR_UPDATED_BY_ADMIN" + EV_USR_UPDATED = 6, "EV_USR_UPDATED" + EV_USR_DELETED_BY_ADMIN = 7, "EV_USR_DELETED_BY_ADMIN" + EV_DID_CREATED_BY_USER = 8, "EV_DID_CREATED_BY_USER" + EV_DID_CREATED = 9, "EV_DID_CREATED" + EV_DID_DELETED = 10, "EV_DID_DELETED" + EV_CREDENTIAL_DELETED_BY_ADMIN = 11, "EV_CREDENTIAL_DELETED_BY_ADMIN" + EV_CREDENTIAL_DELETED = 12, "EV_CREDENTIAL_DELETED" + EV_CREDENTIAL_ISSUED_FOR_USER = 13, "EV_CREDENTIAL_ISSUED_FOR_USER" + EV_CREDENTIAL_ISSUED = 14, "EV_CREDENTIAL_ISSUED" + EV_CREDENTIAL_PRESENTED_BY_USER = 15, "EV_CREDENTIAL_PRESENTED_BY_USER" + EV_CREDENTIAL_PRESENTED = 16, "EV_CREDENTIAL_PRESENTED" + EV_CREDENTIAL_ENABLED = 17, "EV_CREDENTIAL_ENABLED" + EV_CREDENTIAL_CAN_BE_REQUESTED = 18, "EV_CREDENTIAL_CAN_BE_REQUESTED" + EV_CREDENTIAL_REVOKED_BY_ADMIN = 19, "EV_CREDENTIAL_REVOKED_BY_ADMIN" + EV_CREDENTIAL_REVOKED = 20, "EV_CREDENTIAL_REVOKED" + EV_ROLE_CREATED_BY_ADMIN = 21, "EV_ROLE_CREATED_BY_ADMIN" + EV_ROLE_MODIFIED_BY_ADMIN = 22, "EV_ROLE_MODIFIED_BY_ADMIN" + EV_ROLE_DELETED_BY_ADMIN = 23, "EV_ROLE_DELETED_BY_ADMIN" + EV_SERVICE_CREATED_BY_ADMIN = 24, "EV_SERVICE_CREATED_BY_ADMIN" + EV_SERVICE_MODIFIED_BY_ADMIN = 25, "EV_SERVICE_MODIFIED_BY_ADMIN" + EV_SERVICE_DELETED_BY_ADMIN = 26, "EV_SERVICE_DELETED_BY_ADMIN" + EV_ORG_DID_CREATED_BY_ADMIN = 27, "EV_ORG_DID_CREATED_BY_ADMIN" + EV_ORG_DID_DELETED_BY_ADMIN = 28, "EV_ORG_DID_DELETED_BY_ADMIN" + EV_USR_DEACTIVATED_BY_ADMIN = 29, "EV_USR_DEACTIVATED_BY_ADMIN" + EV_USR_ACTIVATED_BY_ADMIN = 30, "EV_USR_ACTIVATED_BY_ADMIN" + created = models.DateTimeField(auto_now=True) + message = models.CharField(max_length=350) + type = models.PositiveSmallIntegerField( + choices=Types.choices, + ) + user = models.ForeignKey( + User, + on_delete=models.CASCADE, + related_name='events', + null=True, + ) + + def get_type(self): + return self.Types(self.type).label + + @classmethod + def set_EV_USR_REGISTERED(cls, user): + msg = _("The user {username} was registered: name: {first_name}, last name: {last_name}").format( + username=user.username, + first_name=user.first_name, + last_name=user.last_name + ) + cls.objects.create( + type=cls.Types.EV_USR_REGISTERED, + message=msg + ) + + @classmethod + def set_EV_USR_WELCOME(cls, user): + msg = _("Welcome. You has been registered: name: {first_name}, last name: {last_name}").format( + first_name=user.first_name, + last_name=user.last_name + ) + cls.objects.create( + type=cls.Types.EV_USR_WELCOME, + message=msg, + user=user + ) + + # Is required? + @classmethod + def set_EV_DATA_UPDATE_REQUESTED_BY_USER(cls, user): + msg = _("The user '{username}' has request the update of the following information: ") + msg += "['field1':'value1', 'field2':'value2'>,...]".format( + username=user.username, + ) + cls.objects.create( + type=cls.Types.EV_DATA_UPDATE_REQUESTED_BY_USER, + message=msg, + ) + + # Is required? + @classmethod + def set_EV_DATA_UPDATE_REQUESTED(cls, user): + msg = _("You have requested the update of the following information: ") + msg += "['field1':'value1', 'field2':'value2'>,...]" + cls.objects.create( + type=cls.Types.EV_DATA_UPDATE_REQUESTED, + message=msg, + user=user + ) + + @classmethod + def set_EV_USR_UPDATED_BY_ADMIN(cls, user): + msg = "The admin has updated the following user 's information: " + msg += "name: {first_name}, last name: {last_name}" + msg = _(msg).format( + first_name=user.first_name, + last_name=user.last_name + ) + cls.objects.create( + type=cls.Types.EV_USR_UPDATED_BY_ADMIN, + message=msg + ) + + @classmethod + def set_EV_USR_UPDATED(cls, user): + msg = "The admin has updated your personal information: " + msg += "name: {first_name}, last name: {last_name}" + msg = _(msg).format( + first_name=user.first_name, + last_name=user.last_name + ) + cls.objects.create( + type=cls.Types.EV_USR_UPDATED, + message=msg, + user=user + ) + + @classmethod + def set_EV_USR_DELETED_BY_ADMIN(cls, user): + msg = _("The admin has deleted the user: username: {username}").format( + username=user.username, + ) + cls.objects.create( + 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( + did=did.did, + username=did.user.username + ) + cls.objects.create( + 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( + label=did.label, + did=did.did + ) + cls.objects.create( + type=cls.Types.EV_DID_CREATED, + 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( + label=did.label, + did=did.did + ) + cls.objects.create( + type=cls.Types.EV_DID_DELETED, + 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( + type=cred.type(), + id=cred.id, + ) + cls.objects.create( + 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( + type=cred.type(), + id=cred.id + ) + cls.objects.create( + type=cls.Types.EV_CREDENTIAL_DELETED, + 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( + type=cred.type(), + id=cred.id, + username=cred.user.username + ) + cls.objects.create( + 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( + type=cred.type(), + id=cred.id + ) + cls.objects.create( + type=cls.Types.EV_CREDENTIAL_ISSUED, + 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}' " + msg += "was presented by user {username} to verifier '{verifier}" + msg = _(msg).format( + type=cred.type(), + id=cred.id, + username=cred.user.username, + verifier=verifier + ) + cls.objects.create( + 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}' " + msg += "was presented to verifier '{verifier}'" + msg = _(msg).format( + type=cred.type(), + id=cred.id, + verifier=verifier + ) + cls.objects.create( + type=cls.Types.EV_CREDENTIAL_PRESENTED, + 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( + type=cred.type(), + username=cred.user.username + ) + cls.objects.create( + 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( + type=cred.type() + ) + cls.objects.create( + type=cls.Types.EV_CREDENTIAL_CAN_BE_REQUESTED, + 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( + type=cred.type(), + id=cred.id + ) + cls.objects.create( + 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( + type=cred.type(), + id=cred.id + ) + cls.objects.create( + type=cls.Types.EV_CREDENTIAL_REVOKED, + message=msg, + user=cred.user + ) + + @classmethod + def set_EV_ROLE_CREATED_BY_ADMIN(cls): + msg = _('A new role was created by admin') + cls.objects.create( + 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') + cls.objects.create( + 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') + cls.objects.create( + 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') + cls.objects.create( + 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') + cls.objects.create( + 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') + cls.objects.create( + 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( + label=did.label, + did=did.did + ) + cls.objects.create( + 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( + label=did.label, + did=did.did + ) + cls.objects.create( + 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: " + msg += "[name:'{first_name}', last name:'{last_name}']" + msg = _(msg).format( + username=user.username, + first_name=user.first_name, + last_name=user.last_name + ) + cls.objects.create( + 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: " + msg += "name:'{first_name}', last name:'{last_name}']" + msg = _(msg).format( + username=user.username, + first_name=user.first_name, + last_name=user.last_name + ) + cls.objects.create( + type=cls.Types.EV_USR_ACTIVATED_BY_ADMIN, + message=msg, + ) + class DID(models.Model): created_at = models.DateTimeField(auto_now=True) @@ -75,7 +457,7 @@ class VerificableCredential(models.Model): id_string = models.CharField(max_length=250) verified = models.BooleanField() created_on = models.DateTimeField(auto_now=True) - issuer_on = models.DateTimeField(null=True) + issued_on = models.DateTimeField(null=True) did_issuer = models.CharField(max_length=250) did_subject = models.CharField(max_length=250) data = models.TextField() @@ -108,9 +490,13 @@ class VerificableCredential(models.Model): data = json.loads(self.data).get('instance').items() return data - def get_issued(self, did): + def issue(self, did): self.status = self.Status.ISSUED self.did_subject = did + self.issued_on = datetime.datetime.now() + + def get_issued_on(self): + return self.issued_on.strftime("%m/%d/%Y") class VCTemplate(models.Model): wkit_template_id = models.CharField(max_length=250) @@ -130,7 +516,7 @@ class Membership(models.Model): class Types(models.IntegerChoices): BENEFICIARY = 1, _('Beneficiary') EMPLOYEE = 2, _('Employee') - PARTNER = 3, _('Partner') + MEMBER = 3, _('Member') type = models.PositiveSmallIntegerField(_('Type of membership'), choices=Types.choices) start_date = models.DateField( @@ -141,7 +527,7 @@ class Membership(models.Model): ) end_date = models.DateField( _('End date'), - help_text=_('What date did the membership end?'), + help_text=_('What date will the membership end?'), blank=True, null=True ) @@ -157,21 +543,24 @@ class Membership(models.Model): class Rol(models.Model): - name = models.CharField(max_length=250) + name = models.CharField(_("name"), max_length=250) + description = models.CharField(_("Description"), max_length=250, null=True) def __str__(self): return self.name class Service(models.Model): - domain = models.CharField(max_length=250) - description = models.CharField(max_length=250) + domain = models.CharField(_("Domain"), max_length=250) + description = models.CharField(_("Description"), max_length=250) rol = models.ManyToManyField( Rol, ) def get_roles(self): - return ", ".join([x.name for x in self.rol.all()]) + if self.rol.exists(): + return ", ".join([x.name for x in self.rol.all()]) + return _("None") def __str__(self): return "{} -> {}".format(self.domain, self.get_roles()) @@ -189,6 +578,9 @@ class UserRol(models.Model): related_name='users', ) + class Meta: + unique_together = ('user', 'service',) + class Organization(models.Model): name = models.CharField(max_length=250) diff --git a/idhub/templates/idhub/admin/credentials.html b/idhub/templates/idhub/admin/credentials.html index 0d7e84c..06cd110 100644 --- a/idhub/templates/idhub/admin/credentials.html +++ b/idhub/templates/idhub/admin/credentials.html @@ -14,8 +14,8 @@ - - + + @@ -25,8 +25,8 @@ {{ f.type }} {{ f.description }} - {{ f.issue_on }} - {{ f.get_status }} + {{ f.get_issued_on }} + {{ f.get_status }} {{ f.user.email }} {% trans 'View' %} diff --git a/idhub/templates/idhub/admin/dashboard.html b/idhub/templates/idhub/admin/dashboard.html index 90f0050..a94bffb 100644 --- a/idhub/templates/idhub/admin/dashboard.html +++ b/idhub/templates/idhub/admin/dashboard.html @@ -10,131 +10,20 @@ - - - - - + + + + {% for ev in events %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + {% endfor %}
#
1,001randomdataplaceholdertext
1,002placeholderirrelevantvisuallayout
1,003datarichdashboardtabular
1,003informationplaceholderillustrativedata
1,004textrandomlayoutdashboard
1,005dashboardirrelevanttextplaceholder
1,006dashboardillustrativerichdata
1,007placeholdertabularinformationirrelevant
1,008randomdataplaceholdertext
1,009placeholderirrelevantvisuallayout
1,010datarichdashboardtabular
1,011informationplaceholderillustrativedata
1,012textplaceholderlayoutdashboard
1,013dashboardirrelevanttextvisual
1,014dashboardillustrativerichdata
1,015randomtabularinformationtext{{ ev.get_type }}{{ ev.message }}{{ ev.created }}
-
-
-
-
{% endblock %} diff --git a/idhub/templates/idhub/admin/dids.html b/idhub/templates/idhub/admin/dids.html index 0bac4c5..88cff01 100644 --- a/idhub/templates/idhub/admin/dids.html +++ b/idhub/templates/idhub/admin/dids.html @@ -32,7 +32,7 @@
diff --git a/idhub/templates/idhub/admin/import.html b/idhub/templates/idhub/admin/import.html index 0b74600..288c872 100644 --- a/idhub/templates/idhub/admin/import.html +++ b/idhub/templates/idhub/admin/import.html @@ -14,7 +14,7 @@ - + @@ -28,7 +28,7 @@
- {% translate "Import Datas" %} + {% translate "Import data" %}
diff --git a/idhub/templates/idhub/admin/people.html b/idhub/templates/idhub/admin/people.html index 2df8577..a165bd3 100644 --- a/idhub/templates/idhub/admin/people.html +++ b/idhub/templates/idhub/admin/people.html @@ -13,26 +13,22 @@ - - + + {% for user in users %} - {{ user.last_name }} - {{ user.first_name }} + {{ user.last_name|default:'' }} + {{ user.first_name|default:'' }} {{ user.email }} - - {% for m in user.memberships.all %} - {{ m.get_type }} - {% endfor %} + + {{ user.get_memberships }} - - {% for r in user.roles.all %} - {{ r.service.get_roles }} - {% endfor %} + + {{ user.get_roles }} {% trans 'View' %} diff --git a/idhub/templates/idhub/admin/roles.html b/idhub/templates/idhub/admin/roles.html index feed044..25bfd93 100644 --- a/idhub/templates/idhub/admin/roles.html +++ b/idhub/templates/idhub/admin/roles.html @@ -12,7 +12,8 @@ - + + @@ -21,6 +22,7 @@ {% for rol in roles.all %} + @@ -28,7 +30,7 @@
{{ rol.name }}{{ rol.description|default:""}}
- {% translate "Add Rol" %} + {% translate "Add Role" %}
diff --git a/idhub/templates/idhub/admin/schemas.html b/idhub/templates/idhub/admin/schemas.html index 2aa2e88..2696b01 100644 --- a/idhub/templates/idhub/admin/schemas.html +++ b/idhub/templates/idhub/admin/schemas.html @@ -34,7 +34,7 @@
- {% translate "Add Template" %} + {% translate "Add template" %}
@@ -45,7 +45,7 @@ -
-
-
-
{% endblock %} diff --git a/idhub/templates/idhub/user/profile.html b/idhub/templates/idhub/user/profile.html index da1597a..fe5d6e8 100644 --- a/idhub/templates/idhub/user/profile.html +++ b/idhub/templates/idhub/user/profile.html @@ -31,11 +31,6 @@
{% endif %} {% bootstrap_form form %} -
- {% translate "Cancel" %} - -
-
diff --git a/idhub/templates/idhub/user/roles.html b/idhub/templates/idhub/user/roles.html index 0295b53..2c32e97 100644 --- a/idhub/templates/idhub/user/roles.html +++ b/idhub/templates/idhub/user/roles.html @@ -12,7 +12,7 @@ - + diff --git a/idhub/user/forms.py b/idhub/user/forms.py index a8f6997..173f3a8 100644 --- a/idhub/user/forms.py +++ b/idhub/user/forms.py @@ -44,7 +44,7 @@ class RequestCredentialForm(forms.Form): did = did[0].did cred = cred[0] - cred.get_issued(did) + cred.issue(did) if commit: cred.save() @@ -72,23 +72,23 @@ class CredentialPresentationForm(forms.Form): ] def save(self, commit=True): - org = Organization.objects.filter( + self.org = Organization.objects.filter( id=self.data['organization'] ) - cred = VerificableCredential.objects.filter( + self.cred = VerificableCredential.objects.filter( user=self.user, id=self.data['credential'], status=VerificableCredential.Status.ISSUED ) - if not all([org.exists(), cred.exists()]): + if not all([self.org.exists(), self.cred.exists()]): return - org =org[0] - cred = cred[0] + self.org = self.org[0] + self.cred = self.cred[0] if commit: - org.send(cred) - return cred + self.org.send(self.cred) + return self.cred return diff --git a/idhub/user/views.py b/idhub/user/views.py index 02c0cfe..3dffbc9 100644 --- a/idhub/user/views.py +++ b/idhub/user/views.py @@ -14,7 +14,7 @@ from django.http import HttpResponse from django.contrib import messages from idhub.user.forms import ProfileForm, RequestCredentialForm, CredentialPresentationForm from idhub.mixins import UserView -from idhub.models import DID, VerificableCredential +from idhub.models import DID, VerificableCredential, Event class MyProfile(UserView): @@ -23,7 +23,7 @@ class MyProfile(UserView): class MyWallet(UserView): - title = _("My Wallet") + title = _("My wallet") section = "MyWallet" @@ -37,7 +37,7 @@ class DashboardView(UserView, TemplateView): class ProfileView(MyProfile, UpdateView): template_name = "idhub/user/profile.html" - subtitle = _('My personal Data') + subtitle = _('My personal data') icon = 'bi bi-person' from_class = ProfileForm fields = ('first_name', 'last_name', 'email') @@ -46,6 +46,16 @@ class ProfileView(MyProfile, UpdateView): def get_object(self): return self.request.user + def get_form(self): + form = super().get_form() + form.fields['first_name'].disabled = True + form.fields['last_name'].disabled = True + form.fields['email'].disabled = True + return form + + def form_valid(self, form): + return super().form_valid(form) + class RolesView(MyProfile, TemplateView): template_name = "idhub/user/roles.html" @@ -61,7 +71,7 @@ class GDPRView(MyProfile, TemplateView): class CredentialsView(MyWallet, TemplateView): template_name = "idhub/user/credentials.html" - subtitle = _('Credentials') + subtitle = _('Credential management') icon = 'bi bi-patch-check-fill' def get_context_data(self, **kwargs): @@ -110,7 +120,7 @@ class CredentialJsonView(MyWallet, TemplateView): class CredentialsRequestView(MyWallet, FormView): template_name = "idhub/user/credentials_request.html" - subtitle = _('Credentials request') + subtitle = _('Credential request') icon = 'bi bi-patch-check-fill' form_class = RequestCredentialForm success_url = reverse_lazy('idhub:user_credentials') @@ -123,15 +133,17 @@ class CredentialsRequestView(MyWallet, FormView): def form_valid(self, form): cred = form.save() if cred: - messages.success(self.request, _("The credential was required successfully!")) + messages.success(self.request, _("The credential was issued successfully!")) + Event.set_EV_CREDENTIAL_ISSUED_FOR_USER(cred) + Event.set_EV_CREDENTIAL_ISSUED(cred) else: - messages.error(self.request, _("Not exists the credential!")) + messages.error(self.request, _("The credential does not exist!")) return super().form_valid(form) class CredentialsPresentationView(MyWallet, FormView): template_name = "idhub/user/credentials_presentation.html" - subtitle = _('Credentials Presentation') + subtitle = _('Credential presentation') icon = 'bi bi-patch-check-fill' form_class = CredentialPresentationForm success_url = reverse_lazy('idhub:user_credentials') @@ -144,6 +156,8 @@ class CredentialsPresentationView(MyWallet, FormView): def form_valid(self, form): cred = form.save() if cred: + Event.set_EV_CREDENTIAL_PRESENTED_BY_USER(cred, form.org) + Event.set_EV_CREDENTIAL_PRESENTED(cred, form.org) messages.success(self.request, _("The credential was presented successfully!")) else: messages.error(self.request, _("Error sending credential!")) @@ -152,7 +166,7 @@ class CredentialsPresentationView(MyWallet, FormView): class DidsView(MyWallet, TemplateView): template_name = "idhub/user/dids.html" - subtitle = _('Identities (DID)') + subtitle = _('Identities (DIDs)') icon = 'bi bi-patch-check-fill' def get_context_data(self, **kwargs): @@ -165,7 +179,7 @@ class DidsView(MyWallet, TemplateView): class DidRegisterView(MyWallet, CreateView): template_name = "idhub/user/did_register.html" - subtitle = _('Add a new Identities (DID)') + subtitle = _('Add a new Identity (DID)') icon = 'bi bi-patch-check-fill' wallet = True model = DID @@ -173,24 +187,20 @@ class DidRegisterView(MyWallet, CreateView): success_url = reverse_lazy('idhub:user_dids') object = None - # def get_form_kwargs(self): - # kwargs = super().get_form_kwargs() - # kwargs['initial'] = { - # 'user': self.request.user - # } - # return kwargs - def form_valid(self, form): form.instance.user = self.request.user form.instance.set_did() form.save() messages.success(self.request, _('DID created successfully')) + + Event.set_EV_DID_CREATED(form.instance) + Event.set_EV_DID_CREATED_BY_USER(form.instance) return super().form_valid(form) class DidEditView(MyWallet, UpdateView): template_name = "idhub/user/did_register.html" - subtitle = _('Identities (DID)') + subtitle = _('Identities (DIDs)') icon = 'bi bi-patch-check-fill' wallet = True model = DID @@ -209,7 +219,7 @@ class DidEditView(MyWallet, UpdateView): class DidDeleteView(MyWallet, DeleteView): - subtitle = _('Identities (DID)') + subtitle = _('Identities (DIDs)') icon = 'bi bi-patch-check-fill' wallet = True model = DID @@ -218,7 +228,9 @@ class DidDeleteView(MyWallet, DeleteView): def get(self, request, *args, **kwargs): self.pk = kwargs['pk'] self.object = get_object_or_404(self.model, pk=self.pk) + Event.set_EV_DID_DELETED(self.object) self.object.delete() messages.success(self.request, _('DID delete successfully')) return redirect(self.success_url) + diff --git a/idhub_auth/forms.py b/idhub_auth/forms.py new file mode 100644 index 0000000..1bc1881 --- /dev/null +++ b/idhub_auth/forms.py @@ -0,0 +1,32 @@ +import re + +from django import forms +from django.utils.translation import gettext_lazy as _ +from idhub_auth.models import User + + +class ProfileForm(forms.ModelForm): + first_name = forms.CharField(required=True) + last_name = forms.CharField(required=True) + + class Meta: + model = User + fields = ['first_name', 'last_name', 'email'] + + def clean_first_name(self): + first_name = super().clean()['first_name'] + if not re.match(r'^[a-zA-Z\s]+$', first_name): + txt = _("The string must contain only characters and spaces") + raise forms.ValidationError(txt) + + return first_name + + def clean_last_name(self): + last_name = super().clean()['last_name'] + if not re.match(r'^[a-zA-Z\s]+$', last_name): + txt = _("The string must contain only characters and spaces") + raise forms.ValidationError(txt) + + return last_name + + diff --git a/idhub_auth/migrations/0001_initial.py b/idhub_auth/migrations/0001_initial.py index 91bc80c..3400ba6 100644 --- a/idhub_auth/migrations/0001_initial.py +++ b/idhub_auth/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.5 on 2023-11-14 14:57 +# Generated by Django 4.2.5 on 2023-11-14 16:48 from django.db import migrations, models diff --git a/idhub_auth/models.py b/idhub_auth/models.py index 64f5491..ccda94c 100644 --- a/idhub_auth/models.py +++ b/idhub_auth/models.py @@ -72,3 +72,16 @@ class User(AbstractBaseUser): def username(self): "Is the email of the user" return self.email + + def get_memberships(self): + members = set( + str(dict(x.Types.choices)[x.type]) for x in self.memberships.all() + ) + return ", ".join(members) + + def get_roles(self): + roles = [] + for s in self.roles.all(): + for r in s.service.rol.all(): + roles.append(r.name) + return ", ".join(set(roles)) diff --git a/locale/ca_ES/LC_MESSAGES/django.po b/locale/ca_ES/LC_MESSAGES/django.po index 38735f3..0b94655 100644 --- a/locale/ca_ES/LC_MESSAGES/django.po +++ b/locale/ca_ES/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-07 17:57+0100\n" +"POT-Creation-Date: 2023-11-13 11:11+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1533,233 +1533,400 @@ msgstr "" msgid "show this help message and exit" msgstr "" -#: idhub/admin/views.py:39 idhub/user/views.py:33 +#: idhub/admin/forms.py:106 +msgid "The user does not exist!" +msgstr "" + +#: idhub/admin/views.py:43 idhub/templates/idhub/base.html:69 +#: idhub/templates/idhub/base_admin.html:69 idhub/user/views.py:33 msgid "Dashboard" msgstr "" -#: idhub/admin/views.py:40 idhub/user/views.py:34 +#: idhub/admin/views.py:44 idhub/templates/idhub/admin/import.html:17 +#: idhub/user/views.py:34 msgid "Success" msgstr "" -#: idhub/admin/views.py:45 -msgid "People Management" +#: idhub/admin/views.py:56 +msgid "User Management" msgstr "" -#: idhub/admin/views.py:50 -msgid "Access Control Management" +#: idhub/admin/views.py:61 +msgid "Access control management" msgstr "" -#: idhub/admin/views.py:55 -msgid "Credentials Management" -msgstr "" - -#: idhub/admin/views.py:60 -msgid "Templates Management" -msgstr "" - -#: idhub/admin/views.py:65 -msgid "Massive Data Management" +#: idhub/admin/views.py:66 +msgid "Credential Management" msgstr "" #: idhub/admin/views.py:71 -msgid "People list" +msgid "Template Management" msgstr "" -#: idhub/admin/views.py:84 -msgid "User Profile" +#: idhub/admin/views.py:76 +msgid "Data file management" msgstr "" -#: idhub/admin/views.py:108 +#: idhub/admin/views.py:82 idhub/templates/idhub/base_admin.html:81 +msgid "View users" +msgstr "" + +#: idhub/admin/views.py:95 +msgid "User personal information" +msgstr "" + +#: idhub/admin/views.py:119 msgid "Is not possible deactivate your account!" msgstr "" -#: idhub/admin/views.py:129 idhub/admin/views.py:235 +#: idhub/admin/views.py:143 idhub/admin/views.py:261 msgid "Is not possible delete your account!" msgstr "" -#: idhub/admin/views.py:141 -msgid "People Register" +#: idhub/admin/views.py:155 +msgid "The account is updated successfully" msgstr "" -#: idhub/admin/views.py:156 -msgid "The account is created successfully" +#: idhub/admin/views.py:164 idhub/templates/idhub/base_admin.html:86 +msgid "Add user" msgstr "" -#: idhub/admin/views.py:167 idhub/admin/views.py:204 +#: idhub/admin/views.py:179 +msgid "The account was created successfully" +msgstr "" + +#: idhub/admin/views.py:193 +msgid "Associate a membership to the user" +msgstr "" + +#: idhub/admin/views.py:230 msgid "People add membership" msgstr "" -#: idhub/admin/views.py:242 -msgid "Add Rol to User" +#: idhub/admin/views.py:268 +msgid "Add a user role to access a service" msgstr "" -#: idhub/admin/views.py:272 -msgid "Edit Rol to User" +#: idhub/admin/views.py:298 +msgid "Modify a user role to access a service" msgstr "" -#: idhub/admin/views.py:307 -msgid "Roles Management" +#: idhub/admin/views.py:333 idhub/templates/idhub/base_admin.html:99 +msgid "Manage roles" msgstr "" -#: idhub/admin/views.py:319 idhub/templates/idhub/admin/roles.html:31 +#: idhub/admin/views.py:345 idhub/templates/idhub/admin/roles.html:31 #: idhub/templates/idhub/admin/user_edit.html:93 -msgid "Add Rol" +msgid "Add Role" msgstr "" -#: idhub/admin/views.py:329 -msgid "Edit Rol" +#: idhub/admin/views.py:354 +msgid "Role created successfully" msgstr "" -#: idhub/admin/views.py:356 -msgid "Service Management" +#: idhub/admin/views.py:361 +msgid "Edit Role" msgstr "" -#: idhub/admin/views.py:368 idhub/templates/idhub/admin/services.html:35 -msgid "Add Service" +#: idhub/admin/views.py:376 +msgid "Role updated successfully" msgstr "" -#: idhub/admin/views.py:378 -msgid "Edit Service" +#: idhub/admin/views.py:389 +msgid "Role deleted successfully" msgstr "" -#: idhub/admin/views.py:405 -msgid "Credentials list" +#: idhub/admin/views.py:396 idhub/templates/idhub/base_admin.html:104 +msgid "Manage services" msgstr "" -#: idhub/admin/views.py:418 +#: idhub/admin/views.py:408 +msgid "Add service" +msgstr "" + +#: idhub/admin/views.py:417 +msgid "Service created successfully" +msgstr "" + +#: idhub/admin/views.py:424 +msgid "Modify service" +msgstr "" + +#: idhub/admin/views.py:439 +msgid "Service updated successfully" +msgstr "" + +#: idhub/admin/views.py:452 +msgid "Service deleted successfully" +msgstr "" + +#: idhub/admin/views.py:459 idhub/templates/idhub/base_admin.html:117 +msgid "View credentials" +msgstr "" + +#: idhub/admin/views.py:472 msgid "Change status of Credential" msgstr "" -#: idhub/admin/views.py:460 +#: idhub/admin/views.py:514 msgid "Credential revoked successfully" msgstr "" -#: idhub/admin/views.py:480 +#: idhub/admin/views.py:536 msgid "Credential deleted successfully" msgstr "" -#: idhub/admin/views.py:487 idhub/admin/views.py:518 idhub/admin/views.py:537 -msgid "Organization Identities (DID)" +#: idhub/admin/views.py:545 +msgid "Manage Identities (DID)" msgstr "" -#: idhub/admin/views.py:500 +#: idhub/admin/views.py:558 msgid "Add a new Organization Identities (DID)" msgstr "" -#: idhub/admin/views.py:512 idhub/user/views.py:188 +#: idhub/admin/views.py:570 idhub/user/views.py:195 msgid "DID created successfully" msgstr "" -#: idhub/admin/views.py:532 idhub/user/views.py:208 +#: idhub/admin/views.py:577 idhub/admin/views.py:596 +msgid "Organization Identities (DID)" +msgstr "" + +#: idhub/admin/views.py:591 idhub/user/views.py:218 msgid "DID updated successfully" msgstr "" -#: idhub/admin/views.py:547 idhub/user/views.py:223 +#: idhub/admin/views.py:607 idhub/user/views.py:234 msgid "DID delete successfully" msgstr "" -#: idhub/admin/views.py:554 idhub/templates/idhub/user/profile.html:51 -#: idhub/user/views.py:65 -msgid "Credentials" +#: idhub/admin/views.py:613 idhub/templates/idhub/base_admin.html:132 +msgid "View org. credentials" msgstr "" -#: idhub/admin/views.py:561 -msgid "Configure Issues" +#: idhub/admin/views.py:620 idhub/templates/idhub/base_admin.html:137 +msgid "Configure credential issuance" msgstr "" -#: idhub/admin/views.py:568 -msgid "Template List" +#: idhub/admin/views.py:627 +msgid "View credential templates" msgstr "" -#: idhub/admin/views.py:602 -msgid "Upload Template" +#: idhub/admin/views.py:661 +msgid "Upload template" msgstr "" -#: idhub/admin/views.py:618 idhub/admin/views.py:744 +#: idhub/admin/views.py:677 msgid "There are some errors in the file" msgstr "" -#: idhub/admin/views.py:632 +#: idhub/admin/views.py:691 msgid "This template already exists!" msgstr "" -#: idhub/admin/views.py:638 idhub/admin/views.py:683 +#: idhub/admin/views.py:697 idhub/admin/views.py:742 msgid "This is not a schema valid!" msgstr "" -#: idhub/admin/views.py:647 -msgid "Import Template" +#: idhub/admin/views.py:706 +msgid "Import template" msgstr "" -#: idhub/admin/views.py:675 -msgid "The schema add successfully!" +#: idhub/admin/views.py:734 +msgid "The schema was added sucessfully" msgstr "" -#: idhub/admin/views.py:700 idhub/admin/views.py:713 idhub/admin/views.py:726 +#: idhub/admin/views.py:759 idhub/templates/idhub/admin/import.html:31 +#: idhub/templates/idhub/base_admin.html:153 +msgid "Import data" +msgstr "" + +#: idhub/admin/views.py:772 idhub/admin/views.py:785 msgid "Import" msgstr "" -#: idhub/admin/views.py:755 -msgid "There aren't file" +#: idhub/admin/views.py:798 +msgid "The file import was successfully!" msgstr "" -#: idhub/admin/views.py:760 -msgid "This file already exists!" -msgstr "" - -#: idhub/admin/views.py:799 -msgid "The user not exist!" -msgstr "" - -#: idhub/models.py:57 -msgid "Enabled" +#: idhub/admin/views.py:803 +msgid "Error importing the file!" msgstr "" #: idhub/models.py:58 +#, python-brace-format +msgid "" +"The user {username} was registered: name: {first_name}, last name: " +"{last_name}" +msgstr "" + +#: idhub/models.py:70 +#, python-brace-format +msgid "" +"Welcome. You has been registered: name: {first_name}, last name: {last_name}" +msgstr "" + +#: idhub/models.py:83 +#, python-brace-format +msgid "" +"The user '{username}' has request the update of the following information: " +msgstr "" + +#: idhub/models.py:95 +msgid "You have requested the update of the following information: " +msgstr "" + +#: idhub/models.py:132 +#, python-brace-format +msgid "The admin has deleted the user: username: {username}" +msgstr "" + +#: idhub/models.py:142 +#, python-brace-format +msgid "New DID with DID-ID: '{did}' created by user '{username}'" +msgstr "" + +#: idhub/models.py:153 +#, python-brace-format +msgid "New DID with label: '{label}' and DID-ID: '{did}' was created'" +msgstr "" + +#: idhub/models.py:165 +#, python-brace-format +msgid "" +"The DID with label '{label}' and DID-ID: '{did}' was deleted from your wallet" +msgstr "" + +#: idhub/models.py:177 +#, python-brace-format +msgid "The credential of type '{type}' and ID: '{id}' was deleted" +msgstr "" + +#: idhub/models.py:188 +#, python-brace-format +msgid "" +"The credential of type '{type}' and ID: '{id}' was deleted from your wallet" +msgstr "" + +#: idhub/models.py:200 +#, python-brace-format +msgid "" +"The credential of type '{type}' and ID: '{id}' was issued for user {username}" +msgstr "" + +#: idhub/models.py:212 +#, python-brace-format +msgid "" +"The credential of type '{type}' and ID: '{id}' was issued and stored in your " +"wallet" +msgstr "" + +#: idhub/models.py:254 +#, python-brace-format +msgid "The credential of type '{type}' was enabled for user {username}" +msgstr "" + +#: idhub/models.py:265 +#, python-brace-format +msgid "You can request the '{type}' credential" +msgstr "" + +#: idhub/models.py:276 +#, python-brace-format +msgid "The credential of type '{type}' and ID: '{id}' was revoked for " +msgstr "" + +#: idhub/models.py:287 +#, python-brace-format +msgid "The credential of type '{type}' and ID: '{id}' was revoked by admin" +msgstr "" + +#: idhub/models.py:299 +msgid "A new role was created by admin" +msgstr "" + +#: idhub/models.py:307 +msgid "The role was modified by admin" +msgstr "" + +#: idhub/models.py:315 +msgid "The role was removed by admin" +msgstr "" + +#: idhub/models.py:323 +msgid "A new service was created by admin" +msgstr "" + +#: idhub/models.py:331 +msgid "The service was modified by admin" +msgstr "" + +#: idhub/models.py:339 +msgid "The service was removed by admin" +msgstr "" + +#: idhub/models.py:347 +#, python-brace-format +msgid "" +"New Organisational DID with label: '{label}' and DID-ID: '{did}' was created" +msgstr "" + +#: idhub/models.py:358 +#, python-brace-format +msgid "" +"Organisational DID with label: '{label}' and DID-ID: '{did}' was removed" +msgstr "" + +#: idhub/models.py:438 +msgid "Enabled" +msgstr "" + +#: idhub/models.py:439 idhub/templates/idhub/admin/credentials.html:17 +#: idhub/templates/idhub/user/credentials.html:17 msgid "Issued" msgstr "" -#: idhub/models.py:59 +#: idhub/models.py:440 msgid "Revoked" msgstr "" -#: idhub/models.py:60 +#: idhub/models.py:441 msgid "Expired" msgstr "" -#: idhub/models.py:118 +#: idhub/models.py:499 msgid "Beneficiary" msgstr "" -#: idhub/models.py:119 +#: idhub/models.py:500 msgid "Employee" msgstr "" -#: idhub/models.py:120 -msgid "Partner" +#: idhub/models.py:501 +msgid "Member" msgstr "" -#: idhub/models.py:122 +#: idhub/models.py:503 msgid "Type of membership" msgstr "" -#: idhub/models.py:124 +#: idhub/models.py:505 msgid "Start date" msgstr "" -#: idhub/models.py:125 +#: idhub/models.py:506 msgid "What date did the membership start?" msgstr "" -#: idhub/models.py:130 +#: idhub/models.py:511 msgid "End date" msgstr "" -#: idhub/models.py:131 -msgid "What date did the membership end?" +#: idhub/models.py:512 +msgid "What date will the membership end?" msgstr "" -#: idhub/models.py:183 +#: idhub/models.py:564 msgid "Url where to send the presentation" msgstr "" @@ -1889,7 +2056,9 @@ msgid "Password reset on %(site_name)s" msgstr "" #: idhub/templates/idhub/admin/credentials.html:15 +#: idhub/templates/idhub/admin/dashboard.html:13 #: idhub/templates/idhub/user/credentials.html:15 +#: idhub/templates/idhub/user/dashboard.html:13 #: idhub/templates/templates/musician/billing.html:21 #: idhub/templates/templates/musician/databases.html:17 #: idhub/templates/templates/musician/domain_detail.html:17 @@ -1901,11 +2070,6 @@ msgstr "" msgid "Details" msgstr "" -#: idhub/templates/idhub/admin/credentials.html:17 -#: idhub/templates/idhub/user/credentials.html:17 -msgid "Issue" -msgstr "" - #: idhub/templates/idhub/admin/credentials.html:18 #: idhub/templates/idhub/user/credentials.html:18 msgid "Status" @@ -1921,8 +2085,25 @@ msgstr "" msgid "View" msgstr "" +#: idhub/templates/idhub/admin/dashboard.html:14 +#: idhub/templates/idhub/admin/schemas.html:18 +#: idhub/templates/idhub/admin/services.html:16 +#: idhub/templates/idhub/admin/user.html:88 +#: idhub/templates/idhub/admin/user_edit.html:74 +#: idhub/templates/idhub/user/dashboard.html:14 +#: idhub/templates/idhub/user/roles.html:16 +msgid "Description" +msgstr "" + +#: idhub/templates/idhub/admin/dashboard.html:15 +#: idhub/templates/idhub/admin/dids.html:15 +#: idhub/templates/idhub/user/dashboard.html:15 +#: idhub/templates/idhub/user/dids.html:15 +msgid "Date" +msgstr "" + #: idhub/templates/idhub/admin/did_register.html:29 -#: idhub/templates/idhub/admin/import_step3.html:27 +#: idhub/templates/idhub/admin/import_add.html:27 #: idhub/templates/idhub/admin/people_membership_register.html:29 #: idhub/templates/idhub/admin/people_register.html:25 #: idhub/templates/idhub/admin/people_rol_register.html:29 @@ -1933,7 +2114,6 @@ msgstr "" #: idhub/templates/idhub/user/credentials_presentation.html:29 #: idhub/templates/idhub/user/credentials_request.html:29 #: idhub/templates/idhub/user/did_register.html:29 -#: idhub/templates/idhub/user/profile.html:35 #: idhub/templates/templates/musician/address_check_delete.html:10 #: idhub/templates/templates/musician/address_form.html:11 #: idhub/templates/templates/musician/mailbox_change_password.html:11 @@ -1943,7 +2123,7 @@ msgid "Cancel" msgstr "" #: idhub/templates/idhub/admin/did_register.html:30 -#: idhub/templates/idhub/admin/import_step3.html:28 +#: idhub/templates/idhub/admin/import_add.html:28 #: idhub/templates/idhub/admin/people_membership_register.html:30 #: idhub/templates/idhub/admin/people_register.html:26 #: idhub/templates/idhub/admin/people_rol_register.html:30 @@ -1952,18 +2132,12 @@ msgstr "" #: idhub/templates/idhub/admin/service_register.html:30 #: idhub/templates/idhub/admin/user_edit.html:28 #: idhub/templates/idhub/user/did_register.html:30 -#: idhub/templates/idhub/user/profile.html:36 #: idhub/templates/templates/musician/address_form.html:12 #: idhub/templates/templates/musician/mailbox_change_password.html:12 #: idhub/templates/templates/musician/mailbox_form.html:21 msgid "Save" msgstr "" -#: idhub/templates/idhub/admin/dids.html:15 -#: idhub/templates/idhub/user/dids.html:15 -msgid "Date" -msgstr "" - #: idhub/templates/idhub/admin/dids.html:16 #: idhub/templates/idhub/user/dids.html:16 msgid "Label" @@ -1985,8 +2159,7 @@ msgid "Remove" msgstr "" #: idhub/templates/idhub/admin/dids.html:35 -#: idhub/templates/idhub/user/dids.html:35 -msgid "Add Identity" +msgid "Add identity" msgstr "" #: idhub/templates/idhub/admin/dids.html:46 @@ -2000,28 +2173,10 @@ msgid "Are you sure that you want delete this DID?" msgstr "" #: idhub/templates/idhub/admin/import.html:15 -#: idhub/templates/idhub/admin/import_step2.html:15 #: idhub/templates/idhub/admin/schemas.html:15 msgid "Created at" msgstr "" -#: idhub/templates/idhub/admin/import.html:17 -msgid "success" -msgstr "" - -#: idhub/templates/idhub/admin/import.html:31 -msgid "Import Datas" -msgstr "" - -#: idhub/templates/idhub/admin/import_step2.html:16 -#: idhub/templates/idhub/admin/schemas.html:16 -msgid "Template file" -msgstr "" - -#: idhub/templates/idhub/admin/import_step2.html:26 -msgid "Import Dates" -msgstr "" - #: idhub/templates/idhub/admin/issue_credentials.html:14 #: idhub/templates/idhub/admin/issue_credentials.html:72 msgid "Revoke" @@ -2059,11 +2214,16 @@ msgstr "" #: idhub/templates/idhub/admin/people.html:16 #: idhub/templates/idhub/admin/user.html:62 #: idhub/templates/idhub/admin/user_edit.html:41 -#: idhub/templates/idhub/user/profile.html:48 +#: idhub/templates/idhub/user/profile.html:43 msgid "Membership" msgstr "" #: idhub/templates/idhub/admin/people.html:17 +#: idhub/templates/idhub/admin/roles.html:15 +#: idhub/templates/idhub/admin/services.html:17 +#: idhub/templates/idhub/admin/user.html:87 +#: idhub/templates/idhub/admin/user_edit.html:73 +#: idhub/templates/idhub/user/roles.html:15 msgid "Role" msgstr "" @@ -2105,12 +2265,8 @@ msgstr "" msgid "User activation on %(site)s" msgstr "" -#: idhub/templates/idhub/admin/roles.html:15 -#: idhub/templates/idhub/admin/services.html:17 -#: idhub/templates/idhub/admin/user.html:87 -#: idhub/templates/idhub/admin/user_edit.html:73 -#: idhub/templates/idhub/user/roles.html:15 -msgid "Rol" +#: idhub/templates/idhub/admin/schemas.html:16 +msgid "Template file" msgstr "" #: idhub/templates/idhub/admin/schemas.html:17 @@ -2118,20 +2274,13 @@ msgstr "" msgid "Name" msgstr "" -#: idhub/templates/idhub/admin/schemas.html:18 -#: idhub/templates/idhub/admin/services.html:16 -#: idhub/templates/idhub/admin/user.html:88 -#: idhub/templates/idhub/admin/user_edit.html:74 -#: idhub/templates/idhub/user/roles.html:16 -msgid "Description" -msgstr "" - #: idhub/templates/idhub/admin/schemas.html:37 -msgid "Add Template" +#: idhub/templates/idhub/admin/schemas_import.html:29 +msgid "Add template" msgstr "" #: idhub/templates/idhub/admin/schemas.html:48 -msgid "Delete Template" +msgid "Delete template" msgstr "" #: idhub/templates/idhub/admin/schemas.html:52 @@ -2139,17 +2288,13 @@ msgid "Are you sure that you want delete this template?" msgstr "" #: idhub/templates/idhub/admin/schemas_import.html:15 -msgid "Template available" +msgid "Available templates" msgstr "" #: idhub/templates/idhub/admin/schemas_import.html:23 msgid "Add" msgstr "" -#: idhub/templates/idhub/admin/schemas_import.html:29 -msgid "Add template" -msgstr "" - #: idhub/templates/idhub/admin/services.html:15 #: idhub/templates/idhub/admin/user.html:89 #: idhub/templates/idhub/admin/user_edit.html:75 @@ -2157,6 +2302,10 @@ msgstr "" msgid "Service" msgstr "" +#: idhub/templates/idhub/admin/services.html:35 +msgid "Add Service" +msgstr "" + #: idhub/templates/idhub/admin/user.html:13 msgid "Modify" msgstr "" @@ -2171,13 +2320,13 @@ msgstr "" #: idhub/templates/idhub/admin/user.html:63 #: idhub/templates/idhub/admin/user_edit.html:42 -#: idhub/templates/idhub/user/profile.html:49 +#: idhub/templates/idhub/user/profile.html:44 msgid "From" msgstr "" #: idhub/templates/idhub/admin/user.html:64 #: idhub/templates/idhub/admin/user_edit.html:43 -#: idhub/templates/idhub/user/profile.html:50 +#: idhub/templates/idhub/user/profile.html:45 msgid "To" msgstr "" @@ -2193,6 +2342,67 @@ msgstr "" msgid "Add membership" msgstr "" +#: idhub/templates/idhub/base.html:76 +msgid "My information" +msgstr "" + +#: idhub/templates/idhub/base.html:81 +msgid "My personal information" +msgstr "" + +#: idhub/templates/idhub/base.html:86 idhub/user/views.py:63 +msgid "My roles" +msgstr "" + +#: idhub/templates/idhub/base.html:91 idhub/user/views.py:69 +msgid "GDPR info" +msgstr "" + +#: idhub/templates/idhub/base.html:99 idhub/user/views.py:27 +msgid "My wallet" +msgstr "" + +#: idhub/templates/idhub/base.html:104 idhub/user/views.py:170 +#: idhub/user/views.py:204 idhub/user/views.py:223 +msgid "Identities (DIDs)" +msgstr "" + +#: idhub/templates/idhub/base.html:109 +msgid "My credentials" +msgstr "" + +#: idhub/templates/idhub/base.html:114 +msgid "Request a credential" +msgstr "" + +#: idhub/templates/idhub/base.html:119 +msgid "Present a credential" +msgstr "" + +#: idhub/templates/idhub/base_admin.html:76 +msgid "User managament" +msgstr "" + +#: idhub/templates/idhub/base_admin.html:94 +msgid "Access control managament" +msgstr "" + +#: idhub/templates/idhub/base_admin.html:112 idhub/user/views.py:75 +msgid "Credential management" +msgstr "" + +#: idhub/templates/idhub/base_admin.html:122 +msgid "Organization's wallet" +msgstr "" + +#: idhub/templates/idhub/base_admin.html:127 +msgid "Manage Identities (DIDs)" +msgstr "" + +#: idhub/templates/idhub/base_admin.html:147 +msgid "Credential template management" +msgstr "" + #: idhub/templates/idhub/user/credentials_presentation.html:30 msgid "Send" msgstr "" @@ -2201,6 +2411,10 @@ msgstr "" msgid "Request" msgstr "" +#: idhub/templates/idhub/user/dids.html:35 +msgid "Add Identity" +msgstr "" + #: idhub/templates/idhub/user/profile.html:13 msgid "ARCO Forms" msgstr "" @@ -2209,6 +2423,10 @@ msgstr "" msgid "Notice of Privacy" msgstr "" +#: idhub/templates/idhub/user/profile.html:46 +msgid "Credentials" +msgstr "" + #: idhub/templates/templates/musician/address_check_delete.html:7 #, python-format msgid "Are you sure that you want remove the address: \"%(address_name)s\"?" @@ -2510,54 +2728,38 @@ msgstr "" msgid "My profile" msgstr "" -#: idhub/user/views.py:27 -msgid "My Wallet" -msgstr "" - #: idhub/user/views.py:41 -msgid "My personal Data" +msgid "My personal data" msgstr "" -#: idhub/user/views.py:53 -msgid "My roles" -msgstr "" - -#: idhub/user/views.py:59 -msgid "GDPR info" -msgstr "" - -#: idhub/user/views.py:78 +#: idhub/user/views.py:88 msgid "Credential" msgstr "" -#: idhub/user/views.py:114 -msgid "Credentials request" +#: idhub/user/views.py:124 +msgid "Credential request" msgstr "" -#: idhub/user/views.py:127 -msgid "The credential was required successfully!" +#: idhub/user/views.py:137 +msgid "The credential was issued successfully!" msgstr "" -#: idhub/user/views.py:129 -msgid "Not exists the credential!" +#: idhub/user/views.py:141 +msgid "The credential does not exist!" msgstr "" -#: idhub/user/views.py:135 -msgid "Credentials Presentation" +#: idhub/user/views.py:147 +msgid "Credential presentation" msgstr "" -#: idhub/user/views.py:148 +#: idhub/user/views.py:162 msgid "The credential was presented successfully!" msgstr "" -#: idhub/user/views.py:150 +#: idhub/user/views.py:164 msgid "Error sending credential!" msgstr "" -#: idhub/user/views.py:156 idhub/user/views.py:194 idhub/user/views.py:213 -msgid "Identities (DID)" -msgstr "" - -#: idhub/user/views.py:169 -msgid "Add a new Identities (DID)" +#: idhub/user/views.py:183 +msgid "Add a new Identity (DID)" msgstr "" diff --git a/locale/es/LC_MESSAGES/django.po b/locale/es/LC_MESSAGES/django.po index e84bbd5..d0b34ef 100644 --- a/locale/es/LC_MESSAGES/django.po +++ b/locale/es/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-07 17:54+0100\n" +"POT-Creation-Date: 2023-11-13 11:12+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1533,233 +1533,400 @@ msgstr "" msgid "show this help message and exit" msgstr "" -#: idhub/admin/views.py:39 idhub/user/views.py:33 +#: idhub/admin/forms.py:106 +msgid "The user does not exist!" +msgstr "" + +#: idhub/admin/views.py:43 idhub/templates/idhub/base.html:69 +#: idhub/templates/idhub/base_admin.html:69 idhub/user/views.py:33 msgid "Dashboard" msgstr "" -#: idhub/admin/views.py:40 idhub/user/views.py:34 +#: idhub/admin/views.py:44 idhub/templates/idhub/admin/import.html:17 +#: idhub/user/views.py:34 msgid "Success" msgstr "" -#: idhub/admin/views.py:45 -msgid "People Management" +#: idhub/admin/views.py:56 +msgid "User Management" msgstr "" -#: idhub/admin/views.py:50 -msgid "Access Control Management" +#: idhub/admin/views.py:61 +msgid "Access control management" msgstr "" -#: idhub/admin/views.py:55 -msgid "Credentials Management" -msgstr "" - -#: idhub/admin/views.py:60 -msgid "Templates Management" -msgstr "" - -#: idhub/admin/views.py:65 -msgid "Massive Data Management" +#: idhub/admin/views.py:66 +msgid "Credential Management" msgstr "" #: idhub/admin/views.py:71 -msgid "People list" +msgid "Template Management" msgstr "" -#: idhub/admin/views.py:84 -msgid "User Profile" +#: idhub/admin/views.py:76 +msgid "Data file management" msgstr "" -#: idhub/admin/views.py:108 +#: idhub/admin/views.py:82 idhub/templates/idhub/base_admin.html:81 +msgid "View users" +msgstr "" + +#: idhub/admin/views.py:95 +msgid "User personal information" +msgstr "" + +#: idhub/admin/views.py:119 msgid "Is not possible deactivate your account!" msgstr "" -#: idhub/admin/views.py:129 idhub/admin/views.py:235 +#: idhub/admin/views.py:143 idhub/admin/views.py:261 msgid "Is not possible delete your account!" msgstr "" -#: idhub/admin/views.py:141 -msgid "People Register" +#: idhub/admin/views.py:155 +msgid "The account is updated successfully" msgstr "" -#: idhub/admin/views.py:156 -msgid "The account is created successfully" +#: idhub/admin/views.py:164 idhub/templates/idhub/base_admin.html:86 +msgid "Add user" msgstr "" -#: idhub/admin/views.py:167 idhub/admin/views.py:204 +#: idhub/admin/views.py:179 +msgid "The account was created successfully" +msgstr "" + +#: idhub/admin/views.py:193 +msgid "Associate a membership to the user" +msgstr "" + +#: idhub/admin/views.py:230 msgid "People add membership" msgstr "" -#: idhub/admin/views.py:242 -msgid "Add Rol to User" +#: idhub/admin/views.py:268 +msgid "Add a user role to access a service" msgstr "" -#: idhub/admin/views.py:272 -msgid "Edit Rol to User" +#: idhub/admin/views.py:298 +msgid "Modify a user role to access a service" msgstr "" -#: idhub/admin/views.py:307 -msgid "Roles Management" +#: idhub/admin/views.py:333 idhub/templates/idhub/base_admin.html:99 +msgid "Manage roles" msgstr "" -#: idhub/admin/views.py:319 idhub/templates/idhub/admin/roles.html:31 +#: idhub/admin/views.py:345 idhub/templates/idhub/admin/roles.html:31 #: idhub/templates/idhub/admin/user_edit.html:93 -msgid "Add Rol" +msgid "Add Role" msgstr "" -#: idhub/admin/views.py:329 -msgid "Edit Rol" +#: idhub/admin/views.py:354 +msgid "Role created successfully" msgstr "" -#: idhub/admin/views.py:356 -msgid "Service Management" +#: idhub/admin/views.py:361 +msgid "Edit Role" msgstr "" -#: idhub/admin/views.py:368 idhub/templates/idhub/admin/services.html:35 -msgid "Add Service" +#: idhub/admin/views.py:376 +msgid "Role updated successfully" msgstr "" -#: idhub/admin/views.py:378 -msgid "Edit Service" +#: idhub/admin/views.py:389 +msgid "Role deleted successfully" msgstr "" -#: idhub/admin/views.py:405 -msgid "Credentials list" +#: idhub/admin/views.py:396 idhub/templates/idhub/base_admin.html:104 +msgid "Manage services" msgstr "" -#: idhub/admin/views.py:418 +#: idhub/admin/views.py:408 +msgid "Add service" +msgstr "" + +#: idhub/admin/views.py:417 +msgid "Service created successfully" +msgstr "" + +#: idhub/admin/views.py:424 +msgid "Modify service" +msgstr "" + +#: idhub/admin/views.py:439 +msgid "Service updated successfully" +msgstr "" + +#: idhub/admin/views.py:452 +msgid "Service deleted successfully" +msgstr "" + +#: idhub/admin/views.py:459 idhub/templates/idhub/base_admin.html:117 +msgid "View credentials" +msgstr "" + +#: idhub/admin/views.py:472 msgid "Change status of Credential" msgstr "" -#: idhub/admin/views.py:460 +#: idhub/admin/views.py:514 msgid "Credential revoked successfully" msgstr "" -#: idhub/admin/views.py:480 +#: idhub/admin/views.py:536 msgid "Credential deleted successfully" msgstr "" -#: idhub/admin/views.py:487 idhub/admin/views.py:518 idhub/admin/views.py:537 -msgid "Organization Identities (DID)" +#: idhub/admin/views.py:545 +msgid "Manage Identities (DID)" msgstr "" -#: idhub/admin/views.py:500 +#: idhub/admin/views.py:558 msgid "Add a new Organization Identities (DID)" msgstr "" -#: idhub/admin/views.py:512 idhub/user/views.py:188 +#: idhub/admin/views.py:570 idhub/user/views.py:195 msgid "DID created successfully" msgstr "" -#: idhub/admin/views.py:532 idhub/user/views.py:208 +#: idhub/admin/views.py:577 idhub/admin/views.py:596 +msgid "Organization Identities (DID)" +msgstr "" + +#: idhub/admin/views.py:591 idhub/user/views.py:218 msgid "DID updated successfully" msgstr "" -#: idhub/admin/views.py:547 idhub/user/views.py:223 +#: idhub/admin/views.py:607 idhub/user/views.py:234 msgid "DID delete successfully" msgstr "" -#: idhub/admin/views.py:554 idhub/templates/idhub/user/profile.html:51 -#: idhub/user/views.py:65 -msgid "Credentials" +#: idhub/admin/views.py:613 idhub/templates/idhub/base_admin.html:132 +msgid "View org. credentials" msgstr "" -#: idhub/admin/views.py:561 -msgid "Configure Issues" +#: idhub/admin/views.py:620 idhub/templates/idhub/base_admin.html:137 +msgid "Configure credential issuance" msgstr "" -#: idhub/admin/views.py:568 -msgid "Template List" +#: idhub/admin/views.py:627 +msgid "View credential templates" msgstr "" -#: idhub/admin/views.py:602 -msgid "Upload Template" +#: idhub/admin/views.py:661 +msgid "Upload template" msgstr "" -#: idhub/admin/views.py:618 idhub/admin/views.py:744 +#: idhub/admin/views.py:677 msgid "There are some errors in the file" msgstr "" -#: idhub/admin/views.py:632 +#: idhub/admin/views.py:691 msgid "This template already exists!" msgstr "" -#: idhub/admin/views.py:638 idhub/admin/views.py:683 +#: idhub/admin/views.py:697 idhub/admin/views.py:742 msgid "This is not a schema valid!" msgstr "" -#: idhub/admin/views.py:647 -msgid "Import Template" +#: idhub/admin/views.py:706 +msgid "Import template" msgstr "" -#: idhub/admin/views.py:675 -msgid "The schema add successfully!" +#: idhub/admin/views.py:734 +msgid "The schema was added sucessfully" msgstr "" -#: idhub/admin/views.py:700 idhub/admin/views.py:713 idhub/admin/views.py:726 +#: idhub/admin/views.py:759 idhub/templates/idhub/admin/import.html:31 +#: idhub/templates/idhub/base_admin.html:153 +msgid "Import data" +msgstr "" + +#: idhub/admin/views.py:772 idhub/admin/views.py:785 msgid "Import" msgstr "" -#: idhub/admin/views.py:755 -msgid "There aren't file" +#: idhub/admin/views.py:798 +msgid "The file import was successfully!" msgstr "" -#: idhub/admin/views.py:760 -msgid "This file already exists!" -msgstr "" - -#: idhub/admin/views.py:799 -msgid "The user not exist!" -msgstr "" - -#: idhub/models.py:57 -msgid "Enabled" +#: idhub/admin/views.py:803 +msgid "Error importing the file!" msgstr "" #: idhub/models.py:58 +#, python-brace-format +msgid "" +"The user {username} was registered: name: {first_name}, last name: " +"{last_name}" +msgstr "" + +#: idhub/models.py:70 +#, python-brace-format +msgid "" +"Welcome. You has been registered: name: {first_name}, last name: {last_name}" +msgstr "" + +#: idhub/models.py:83 +#, python-brace-format +msgid "" +"The user '{username}' has request the update of the following information: " +msgstr "" + +#: idhub/models.py:95 +msgid "You have requested the update of the following information: " +msgstr "" + +#: idhub/models.py:132 +#, python-brace-format +msgid "The admin has deleted the user: username: {username}" +msgstr "" + +#: idhub/models.py:142 +#, python-brace-format +msgid "New DID with DID-ID: '{did}' created by user '{username}'" +msgstr "" + +#: idhub/models.py:153 +#, python-brace-format +msgid "New DID with label: '{label}' and DID-ID: '{did}' was created'" +msgstr "" + +#: idhub/models.py:165 +#, python-brace-format +msgid "" +"The DID with label '{label}' and DID-ID: '{did}' was deleted from your wallet" +msgstr "" + +#: idhub/models.py:177 +#, python-brace-format +msgid "The credential of type '{type}' and ID: '{id}' was deleted" +msgstr "" + +#: idhub/models.py:188 +#, python-brace-format +msgid "" +"The credential of type '{type}' and ID: '{id}' was deleted from your wallet" +msgstr "" + +#: idhub/models.py:200 +#, python-brace-format +msgid "" +"The credential of type '{type}' and ID: '{id}' was issued for user {username}" +msgstr "" + +#: idhub/models.py:212 +#, python-brace-format +msgid "" +"The credential of type '{type}' and ID: '{id}' was issued and stored in your " +"wallet" +msgstr "" + +#: idhub/models.py:254 +#, python-brace-format +msgid "The credential of type '{type}' was enabled for user {username}" +msgstr "" + +#: idhub/models.py:265 +#, python-brace-format +msgid "You can request the '{type}' credential" +msgstr "" + +#: idhub/models.py:276 +#, python-brace-format +msgid "The credential of type '{type}' and ID: '{id}' was revoked for " +msgstr "" + +#: idhub/models.py:287 +#, python-brace-format +msgid "The credential of type '{type}' and ID: '{id}' was revoked by admin" +msgstr "" + +#: idhub/models.py:299 +msgid "A new role was created by admin" +msgstr "" + +#: idhub/models.py:307 +msgid "The role was modified by admin" +msgstr "" + +#: idhub/models.py:315 +msgid "The role was removed by admin" +msgstr "" + +#: idhub/models.py:323 +msgid "A new service was created by admin" +msgstr "" + +#: idhub/models.py:331 +msgid "The service was modified by admin" +msgstr "" + +#: idhub/models.py:339 +msgid "The service was removed by admin" +msgstr "" + +#: idhub/models.py:347 +#, python-brace-format +msgid "" +"New Organisational DID with label: '{label}' and DID-ID: '{did}' was created" +msgstr "" + +#: idhub/models.py:358 +#, python-brace-format +msgid "" +"Organisational DID with label: '{label}' and DID-ID: '{did}' was removed" +msgstr "" + +#: idhub/models.py:438 +msgid "Enabled" +msgstr "" + +#: idhub/models.py:439 idhub/templates/idhub/admin/credentials.html:17 +#: idhub/templates/idhub/user/credentials.html:17 msgid "Issued" msgstr "" -#: idhub/models.py:59 +#: idhub/models.py:440 msgid "Revoked" msgstr "" -#: idhub/models.py:60 +#: idhub/models.py:441 msgid "Expired" msgstr "" -#: idhub/models.py:118 +#: idhub/models.py:499 msgid "Beneficiary" msgstr "" -#: idhub/models.py:119 +#: idhub/models.py:500 msgid "Employee" msgstr "" -#: idhub/models.py:120 -msgid "Partner" +#: idhub/models.py:501 +msgid "Member" msgstr "" -#: idhub/models.py:122 +#: idhub/models.py:503 msgid "Type of membership" msgstr "" -#: idhub/models.py:124 +#: idhub/models.py:505 msgid "Start date" msgstr "" -#: idhub/models.py:125 +#: idhub/models.py:506 msgid "What date did the membership start?" msgstr "" -#: idhub/models.py:130 +#: idhub/models.py:511 msgid "End date" msgstr "" -#: idhub/models.py:131 -msgid "What date did the membership end?" +#: idhub/models.py:512 +msgid "What date will the membership end?" msgstr "" -#: idhub/models.py:183 +#: idhub/models.py:564 msgid "Url where to send the presentation" msgstr "" @@ -1889,7 +2056,9 @@ msgid "Password reset on %(site_name)s" msgstr "" #: idhub/templates/idhub/admin/credentials.html:15 +#: idhub/templates/idhub/admin/dashboard.html:13 #: idhub/templates/idhub/user/credentials.html:15 +#: idhub/templates/idhub/user/dashboard.html:13 #: idhub/templates/templates/musician/billing.html:21 #: idhub/templates/templates/musician/databases.html:17 #: idhub/templates/templates/musician/domain_detail.html:17 @@ -1901,11 +2070,6 @@ msgstr "" msgid "Details" msgstr "" -#: idhub/templates/idhub/admin/credentials.html:17 -#: idhub/templates/idhub/user/credentials.html:17 -msgid "Issue" -msgstr "" - #: idhub/templates/idhub/admin/credentials.html:18 #: idhub/templates/idhub/user/credentials.html:18 msgid "Status" @@ -1921,8 +2085,25 @@ msgstr "" msgid "View" msgstr "" +#: idhub/templates/idhub/admin/dashboard.html:14 +#: idhub/templates/idhub/admin/schemas.html:18 +#: idhub/templates/idhub/admin/services.html:16 +#: idhub/templates/idhub/admin/user.html:88 +#: idhub/templates/idhub/admin/user_edit.html:74 +#: idhub/templates/idhub/user/dashboard.html:14 +#: idhub/templates/idhub/user/roles.html:16 +msgid "Description" +msgstr "" + +#: idhub/templates/idhub/admin/dashboard.html:15 +#: idhub/templates/idhub/admin/dids.html:15 +#: idhub/templates/idhub/user/dashboard.html:15 +#: idhub/templates/idhub/user/dids.html:15 +msgid "Date" +msgstr "" + #: idhub/templates/idhub/admin/did_register.html:29 -#: idhub/templates/idhub/admin/import_step3.html:27 +#: idhub/templates/idhub/admin/import_add.html:27 #: idhub/templates/idhub/admin/people_membership_register.html:29 #: idhub/templates/idhub/admin/people_register.html:25 #: idhub/templates/idhub/admin/people_rol_register.html:29 @@ -1933,7 +2114,6 @@ msgstr "" #: idhub/templates/idhub/user/credentials_presentation.html:29 #: idhub/templates/idhub/user/credentials_request.html:29 #: idhub/templates/idhub/user/did_register.html:29 -#: idhub/templates/idhub/user/profile.html:35 #: idhub/templates/templates/musician/address_check_delete.html:10 #: idhub/templates/templates/musician/address_form.html:11 #: idhub/templates/templates/musician/mailbox_change_password.html:11 @@ -1943,7 +2123,7 @@ msgid "Cancel" msgstr "" #: idhub/templates/idhub/admin/did_register.html:30 -#: idhub/templates/idhub/admin/import_step3.html:28 +#: idhub/templates/idhub/admin/import_add.html:28 #: idhub/templates/idhub/admin/people_membership_register.html:30 #: idhub/templates/idhub/admin/people_register.html:26 #: idhub/templates/idhub/admin/people_rol_register.html:30 @@ -1952,18 +2132,12 @@ msgstr "" #: idhub/templates/idhub/admin/service_register.html:30 #: idhub/templates/idhub/admin/user_edit.html:28 #: idhub/templates/idhub/user/did_register.html:30 -#: idhub/templates/idhub/user/profile.html:36 #: idhub/templates/templates/musician/address_form.html:12 #: idhub/templates/templates/musician/mailbox_change_password.html:12 #: idhub/templates/templates/musician/mailbox_form.html:21 msgid "Save" msgstr "" -#: idhub/templates/idhub/admin/dids.html:15 -#: idhub/templates/idhub/user/dids.html:15 -msgid "Date" -msgstr "" - #: idhub/templates/idhub/admin/dids.html:16 #: idhub/templates/idhub/user/dids.html:16 msgid "Label" @@ -1985,8 +2159,7 @@ msgid "Remove" msgstr "" #: idhub/templates/idhub/admin/dids.html:35 -#: idhub/templates/idhub/user/dids.html:35 -msgid "Add Identity" +msgid "Add identity" msgstr "" #: idhub/templates/idhub/admin/dids.html:46 @@ -2000,28 +2173,10 @@ msgid "Are you sure that you want delete this DID?" msgstr "" #: idhub/templates/idhub/admin/import.html:15 -#: idhub/templates/idhub/admin/import_step2.html:15 #: idhub/templates/idhub/admin/schemas.html:15 msgid "Created at" msgstr "" -#: idhub/templates/idhub/admin/import.html:17 -msgid "success" -msgstr "" - -#: idhub/templates/idhub/admin/import.html:31 -msgid "Import Datas" -msgstr "" - -#: idhub/templates/idhub/admin/import_step2.html:16 -#: idhub/templates/idhub/admin/schemas.html:16 -msgid "Template file" -msgstr "" - -#: idhub/templates/idhub/admin/import_step2.html:26 -msgid "Import Dates" -msgstr "" - #: idhub/templates/idhub/admin/issue_credentials.html:14 #: idhub/templates/idhub/admin/issue_credentials.html:72 msgid "Revoke" @@ -2059,11 +2214,16 @@ msgstr "" #: idhub/templates/idhub/admin/people.html:16 #: idhub/templates/idhub/admin/user.html:62 #: idhub/templates/idhub/admin/user_edit.html:41 -#: idhub/templates/idhub/user/profile.html:48 +#: idhub/templates/idhub/user/profile.html:43 msgid "Membership" msgstr "" #: idhub/templates/idhub/admin/people.html:17 +#: idhub/templates/idhub/admin/roles.html:15 +#: idhub/templates/idhub/admin/services.html:17 +#: idhub/templates/idhub/admin/user.html:87 +#: idhub/templates/idhub/admin/user_edit.html:73 +#: idhub/templates/idhub/user/roles.html:15 msgid "Role" msgstr "" @@ -2105,12 +2265,8 @@ msgstr "" msgid "User activation on %(site)s" msgstr "" -#: idhub/templates/idhub/admin/roles.html:15 -#: idhub/templates/idhub/admin/services.html:17 -#: idhub/templates/idhub/admin/user.html:87 -#: idhub/templates/idhub/admin/user_edit.html:73 -#: idhub/templates/idhub/user/roles.html:15 -msgid "Rol" +#: idhub/templates/idhub/admin/schemas.html:16 +msgid "Template file" msgstr "" #: idhub/templates/idhub/admin/schemas.html:17 @@ -2118,20 +2274,13 @@ msgstr "" msgid "Name" msgstr "" -#: idhub/templates/idhub/admin/schemas.html:18 -#: idhub/templates/idhub/admin/services.html:16 -#: idhub/templates/idhub/admin/user.html:88 -#: idhub/templates/idhub/admin/user_edit.html:74 -#: idhub/templates/idhub/user/roles.html:16 -msgid "Description" -msgstr "" - #: idhub/templates/idhub/admin/schemas.html:37 -msgid "Add Template" +#: idhub/templates/idhub/admin/schemas_import.html:29 +msgid "Add template" msgstr "" #: idhub/templates/idhub/admin/schemas.html:48 -msgid "Delete Template" +msgid "Delete template" msgstr "" #: idhub/templates/idhub/admin/schemas.html:52 @@ -2139,17 +2288,13 @@ msgid "Are you sure that you want delete this template?" msgstr "" #: idhub/templates/idhub/admin/schemas_import.html:15 -msgid "Template available" +msgid "Available templates" msgstr "" #: idhub/templates/idhub/admin/schemas_import.html:23 msgid "Add" msgstr "" -#: idhub/templates/idhub/admin/schemas_import.html:29 -msgid "Add template" -msgstr "" - #: idhub/templates/idhub/admin/services.html:15 #: idhub/templates/idhub/admin/user.html:89 #: idhub/templates/idhub/admin/user_edit.html:75 @@ -2157,6 +2302,10 @@ msgstr "" msgid "Service" msgstr "" +#: idhub/templates/idhub/admin/services.html:35 +msgid "Add Service" +msgstr "" + #: idhub/templates/idhub/admin/user.html:13 msgid "Modify" msgstr "" @@ -2171,13 +2320,13 @@ msgstr "" #: idhub/templates/idhub/admin/user.html:63 #: idhub/templates/idhub/admin/user_edit.html:42 -#: idhub/templates/idhub/user/profile.html:49 +#: idhub/templates/idhub/user/profile.html:44 msgid "From" msgstr "" #: idhub/templates/idhub/admin/user.html:64 #: idhub/templates/idhub/admin/user_edit.html:43 -#: idhub/templates/idhub/user/profile.html:50 +#: idhub/templates/idhub/user/profile.html:45 msgid "To" msgstr "" @@ -2193,6 +2342,67 @@ msgstr "" msgid "Add membership" msgstr "" +#: idhub/templates/idhub/base.html:76 +msgid "My information" +msgstr "" + +#: idhub/templates/idhub/base.html:81 +msgid "My personal information" +msgstr "" + +#: idhub/templates/idhub/base.html:86 idhub/user/views.py:63 +msgid "My roles" +msgstr "" + +#: idhub/templates/idhub/base.html:91 idhub/user/views.py:69 +msgid "GDPR info" +msgstr "" + +#: idhub/templates/idhub/base.html:99 idhub/user/views.py:27 +msgid "My wallet" +msgstr "" + +#: idhub/templates/idhub/base.html:104 idhub/user/views.py:170 +#: idhub/user/views.py:204 idhub/user/views.py:223 +msgid "Identities (DIDs)" +msgstr "" + +#: idhub/templates/idhub/base.html:109 +msgid "My credentials" +msgstr "" + +#: idhub/templates/idhub/base.html:114 +msgid "Request a credential" +msgstr "" + +#: idhub/templates/idhub/base.html:119 +msgid "Present a credential" +msgstr "" + +#: idhub/templates/idhub/base_admin.html:76 +msgid "User managament" +msgstr "" + +#: idhub/templates/idhub/base_admin.html:94 +msgid "Access control managament" +msgstr "" + +#: idhub/templates/idhub/base_admin.html:112 idhub/user/views.py:75 +msgid "Credential management" +msgstr "" + +#: idhub/templates/idhub/base_admin.html:122 +msgid "Organization's wallet" +msgstr "" + +#: idhub/templates/idhub/base_admin.html:127 +msgid "Manage Identities (DIDs)" +msgstr "" + +#: idhub/templates/idhub/base_admin.html:147 +msgid "Credential template management" +msgstr "" + #: idhub/templates/idhub/user/credentials_presentation.html:30 msgid "Send" msgstr "" @@ -2201,6 +2411,10 @@ msgstr "" msgid "Request" msgstr "" +#: idhub/templates/idhub/user/dids.html:35 +msgid "Add Identity" +msgstr "" + #: idhub/templates/idhub/user/profile.html:13 msgid "ARCO Forms" msgstr "" @@ -2209,6 +2423,10 @@ msgstr "" msgid "Notice of Privacy" msgstr "" +#: idhub/templates/idhub/user/profile.html:46 +msgid "Credentials" +msgstr "" + #: idhub/templates/templates/musician/address_check_delete.html:7 #, python-format msgid "Are you sure that you want remove the address: \"%(address_name)s\"?" @@ -2510,54 +2728,38 @@ msgstr "" msgid "My profile" msgstr "" -#: idhub/user/views.py:27 -msgid "My Wallet" -msgstr "" - #: idhub/user/views.py:41 -msgid "My personal Data" +msgid "My personal data" msgstr "" -#: idhub/user/views.py:53 -msgid "My roles" -msgstr "" - -#: idhub/user/views.py:59 -msgid "GDPR info" -msgstr "" - -#: idhub/user/views.py:78 +#: idhub/user/views.py:88 msgid "Credential" msgstr "" -#: idhub/user/views.py:114 -msgid "Credentials request" +#: idhub/user/views.py:124 +msgid "Credential request" msgstr "" -#: idhub/user/views.py:127 -msgid "The credential was required successfully!" +#: idhub/user/views.py:137 +msgid "The credential was issued successfully!" msgstr "" -#: idhub/user/views.py:129 -msgid "Not exists the credential!" +#: idhub/user/views.py:141 +msgid "The credential does not exist!" msgstr "" -#: idhub/user/views.py:135 -msgid "Credentials Presentation" +#: idhub/user/views.py:147 +msgid "Credential presentation" msgstr "" -#: idhub/user/views.py:148 +#: idhub/user/views.py:162 msgid "The credential was presented successfully!" msgstr "" -#: idhub/user/views.py:150 +#: idhub/user/views.py:164 msgid "Error sending credential!" msgstr "" -#: idhub/user/views.py:156 idhub/user/views.py:194 idhub/user/views.py:213 -msgid "Identities (DID)" -msgstr "" - -#: idhub/user/views.py:169 -msgid "Add a new Identities (DID)" +#: idhub/user/views.py:183 +msgid "Add a new Identity (DID)" msgstr "" diff --git a/trustchain_idhub/settings.py b/trustchain_idhub/settings.py index 2537456..fb1c4c3 100644 --- a/trustchain_idhub/settings.py +++ b/trustchain_idhub/settings.py @@ -143,12 +143,8 @@ AUTH_PASSWORD_VALIDATORS = [ # Internationalization # https://docs.djangoproject.com/en/4.2/topics/i18n/ -LANGUAGE_CODE = 'en-us' - TIME_ZONE = config('TIME_ZONE', 'UTC') -USE_I18N = True - USE_TZ = True @@ -181,5 +177,8 @@ MESSAGE_TAGS = { LOCALE_PATHS = [ os.path.join(BASE_DIR, 'locale'), ] +LANGUAGE_CODE="es" +USE_I18N = True +USE_L10N = True AUTH_USER_MODEL = 'idhub_auth.User'