IdHub/idhub/admin/views.py

161 lines
4.0 KiB
Python
Raw Normal View History

2023-10-09 15:59:15 +00:00
import logging
from django.utils.translation import gettext_lazy as _
2023-10-11 07:52:05 +00:00
from django.views.generic.base import TemplateView
2023-10-11 14:23:45 +00:00
from django.contrib.auth.models import User
2023-10-11 16:08:20 +00:00
from django.shortcuts import get_object_or_404
2023-10-09 15:59:15 +00:00
from django.urls import reverse_lazy
from django.contrib import messages
from idhub.mixins import AdminView
2023-10-11 07:52:05 +00:00
class AdminDashboardView(AdminView, TemplateView):
2023-10-09 15:59:15 +00:00
template_name = "idhub/admin_dashboard.html"
title = _('Dashboard')
subtitle = _('Success')
icon = 'bi bi-bell'
section = "Home"
2023-10-11 07:52:05 +00:00
class People(AdminView, TemplateView):
2023-10-09 15:59:15 +00:00
title = _("People Management")
section = "People"
2023-10-11 07:52:05 +00:00
class AccessControl(AdminView, TemplateView):
2023-10-09 15:59:15 +00:00
title = _("Access Control Management")
section = "AccessControl"
2023-10-11 07:52:05 +00:00
class Credentials(AdminView, TemplateView):
2023-10-09 15:59:15 +00:00
title = _("Credentials Management")
section = "Credentials"
2023-10-11 07:52:05 +00:00
class Schemes(AdminView, TemplateView):
2023-10-09 15:59:15 +00:00
title = _("Schemes Management")
section = "Schemes"
2023-10-11 07:52:05 +00:00
class ImportExport(AdminView, TemplateView):
2023-10-09 15:59:15 +00:00
title = _("Massive Data Management")
section = "ImportExport"
2023-10-11 16:08:20 +00:00
class AdminPeopleListView(People):
2023-10-09 15:59:15 +00:00
template_name = "idhub/admin_people.html"
subtitle = _('People list')
icon = 'bi bi-person'
2023-10-11 14:23:45 +00:00
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context.update({
'users': User.objects.filter(),
})
return context
2023-10-09 15:59:15 +00:00
2023-10-11 16:08:20 +00:00
class AdminPeopleView(People):
template_name = "idhub/admin_user.html"
subtitle = _('User Profile')
icon = 'bi bi-person'
model = User
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 get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context.update({
'object': self.object,
})
return context
2023-10-09 15:59:15 +00:00
class AdminPeopleRegisterView(People):
template_name = "idhub/admin_people_register.html"
subtitle = _('People Register')
icon = 'bi bi-person'
class AdminRolesView(AccessControl):
template_name = "idhub/admin_roles.html"
subtitle = _('Roles Management')
2023-10-09 16:12:18 +00:00
icon = ''
2023-10-09 15:59:15 +00:00
class AdminServicesView(AccessControl):
template_name = "idhub/admin_services.html"
subtitle = _('Service Management')
2023-10-09 16:12:18 +00:00
icon = ''
2023-10-09 15:59:15 +00:00
class AdminCredentialsView(Credentials):
template_name = "idhub/admin_credentials.html"
subtitle = _('Credentials list')
2023-10-09 16:12:18 +00:00
icon = ''
2023-10-09 15:59:15 +00:00
class AdminIssueCredentialsView(Credentials):
template_name = "idhub/admin_issue_credentials.html"
subtitle = _('Issuance of Credentials')
2023-10-09 16:12:18 +00:00
icon = ''
2023-10-09 15:59:15 +00:00
class AdminRevokeCredentialsView(Credentials):
template_name = "idhub/admin_revoke_credentials.html"
subtitle = _('Revoke Credentials')
2023-10-09 16:12:18 +00:00
icon = ''
2023-10-09 15:59:15 +00:00
class AdminWalletIdentitiesView(Credentials):
template_name = "idhub/admin_wallet_identities.html"
2023-10-09 16:12:18 +00:00
subtitle = _('Organization Identities (DID)')
icon = 'bi bi-patch-check-fill'
2023-10-09 16:38:28 +00:00
wallet = True
2023-10-09 15:59:15 +00:00
class AdminWalletCredentialsView(Credentials):
template_name = "idhub/admin_wallet_credentials.html"
subtitle = _('Credentials')
2023-10-09 16:12:18 +00:00
icon = 'bi bi-patch-check-fill'
2023-10-09 16:38:28 +00:00
wallet = True
2023-10-09 15:59:15 +00:00
class AdminWalletConfigIssuesView(Credentials):
template_name = "idhub/admin_wallet_issues.html"
subtitle = _('Configure Issues')
2023-10-09 16:12:18 +00:00
icon = 'bi bi-patch-check-fill'
2023-10-09 16:38:28 +00:00
wallet = True
2023-10-09 15:59:15 +00:00
class AdminSchemesView(Schemes):
template_name = "idhub/admin_schemes.html"
subtitle = _('Schemes List')
2023-10-09 16:12:18 +00:00
icon = ''
2023-10-09 15:59:15 +00:00
class AdminSchemesImportView(Schemes):
template_name = "idhub/admin_schemes_import.html"
subtitle = _('Import Schemes')
2023-10-09 16:12:18 +00:00
icon = ''
2023-10-09 15:59:15 +00:00
class AdminSchemesExportView(Schemes):
template_name = "idhub/admin_schemes_export.html"
subtitle = _('Export Schemes')
2023-10-09 16:12:18 +00:00
icon = ''
2023-10-09 15:59:15 +00:00
class AdminImportView(ImportExport):
template_name = "idhub/admin_import.html"
subtitle = _('Import')
2023-10-09 16:12:18 +00:00
icon = ''
2023-10-09 15:59:15 +00:00
class AdminExportView(ImportExport):
template_name = "idhub/admin_export.html"
subtitle = _('Export')
2023-10-09 16:12:18 +00:00
icon = ''