admin sections

This commit is contained in:
Cayo Puigdefabregas 2023-10-09 17:59:15 +02:00
parent f96f8db957
commit 2d4af14b75
20 changed files with 272 additions and 35 deletions

0
idhub/admin/__init__.py Normal file
View File

128
idhub/admin/views.py Normal file
View File

@ -0,0 +1,128 @@
import logging
from django.utils.translation import gettext_lazy as _
from django.urls import reverse_lazy
from django.contrib import messages
from idhub.mixins import AdminView
class AdminDashboardView(AdminView):
template_name = "idhub/admin_dashboard.html"
title = _('Dashboard')
subtitle = _('Success')
icon = 'bi bi-bell'
section = "Home"
class People(AdminView):
title = _("People Management")
section = "People"
class AccessControl(AdminView):
title = _("Access Control Management")
section = "AccessControl"
class Credentials(AdminView):
title = _("Credentials Management")
section = "Credentials"
class Schemes(AdminView):
title = _("Schemes Management")
section = "Schemes"
class ImportExport(AdminView):
title = _("Massive Data Management")
section = "ImportExport"
class AdminPeopleView(People):
template_name = "idhub/admin_people.html"
subtitle = _('People list')
icon = 'bi bi-person'
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')
icon = 'bi bi-person'
class AdminServicesView(AccessControl):
template_name = "idhub/admin_services.html"
subtitle = _('Service Management')
icon = 'bi bi-person'
class AdminCredentialsView(Credentials):
template_name = "idhub/admin_credentials.html"
subtitle = _('Credentials list')
icon = 'bi bi-person'
class AdminIssueCredentialsView(Credentials):
template_name = "idhub/admin_issue_credentials.html"
subtitle = _('Issuance of Credentials')
icon = 'bi bi-person'
class AdminRevokeCredentialsView(Credentials):
template_name = "idhub/admin_revoke_credentials.html"
subtitle = _('Revoke Credentials')
icon = 'bi bi-person'
class AdminWalletIdentitiesView(Credentials):
template_name = "idhub/admin_wallet_identities.html"
subtitle = _('Identities (DID)')
icon = 'bi bi-person'
class AdminWalletCredentialsView(Credentials):
template_name = "idhub/admin_wallet_credentials.html"
subtitle = _('Credentials')
icon = 'bi bi-person'
class AdminWalletConfigIssuesView(Credentials):
template_name = "idhub/admin_wallet_issues.html"
subtitle = _('Configure Issues')
icon = 'bi bi-person'
class AdminSchemesView(Schemes):
template_name = "idhub/admin_schemes.html"
subtitle = _('Schemes List')
icon = 'bi bi-person'
class AdminSchemesImportView(Schemes):
template_name = "idhub/admin_schemes_import.html"
subtitle = _('Import Schemes')
icon = 'bi bi-person'
class AdminSchemesExportView(Schemes):
template_name = "idhub/admin_schemes_export.html"
subtitle = _('Export Schemes')
icon = 'bi bi-person'
class AdminImportView(ImportExport):
template_name = "idhub/admin_import.html"
subtitle = _('Import')
icon = 'bi bi-person'
class AdminExportView(ImportExport):
template_name = "idhub/admin_export.html"
subtitle = _('Export')
icon = 'bi bi-person'

View File

@ -0,0 +1,5 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% block content %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block content %}
<h3>
<i class="bi bi-patch-check"></i>
Identities (DID)
</h3>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>

View File

@ -0,0 +1,5 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% block content %}
{% endblock %}

View File

@ -50,7 +50,7 @@
<div class="navbar-nav">
<div class="nav-item text-nowrap">
<i id="user-avatar" class="bi bi-person-circle"></i>
<a class="navbar-sub-brand px-3" href="#">Lorena</a>
<a class="navbar-sub-brand px-3" href="#">{{ user.username }}</a>
<a class="logout" href="{% url 'idhub:logout' %}">
<i class="fa-solid fa-arrow-right-from-bracket"></i>
</a>
@ -64,66 +64,66 @@
<div class="position-sticky pt-5">
<ul class="nav flex-column">
<li class="nav-item">
<a class="admin nav-link fw-bold" href="javascript:void()">
<a class="admin nav-link {% if section == 'Home' %}active {% endif %}fw-bold" href="{% url 'idhub:admin_dashboard' %}">
<i class="bi bi-house-door icon_sidebar"></i>
Home
</a>
<hr />
</li>
<li class="nav-item">
<a class="admin active nav-link fw-bold" data-bs-toggle="collapse" data-bs-target="#people" aria-expanded="false" aria-controls="people" href="javascript:void()">
<a class="admin {% if section == 'People' %}active {% endif %}nav-link fw-bold" data-bs-toggle="collapse" data-bs-target="#people" aria-expanded="false" aria-controls="people" href="javascript:void()">
<i class="bi bi-people icon_sidebar"></i>
People
</a>
<ul class="flex-column mb-2 ul_sidebar accordion-collapse collapse" id="people" data-bs-parent="#sidebarMenu">
<li class="nav-item">
<a class="nav-link" href="#">
<a class="nav-link" href="{% url 'idhub:admin_people' %}">
People list
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<a class="nav-link" href="{% url 'idhub:admin_people_new' %}">
Register a new user
</a>
</li>
</ul>
</li>
<li class="nav-item">
<a class="admin nav-link fw-bold" data-bs-toggle="collapse" data-bs-target="#control-access" aria-expanded="false" aria-controls="control-access" href="javascript:void()">
<a class="admin nav-link {% if section == 'AccessControl' %}active {% endif %}fw-bold" data-bs-toggle="collapse" data-bs-target="#control-access" aria-expanded="false" aria-controls="control-access" href="javascript:void()">
<i class="fa-solid fa-arrow-right-from-bracket icon_sidebar"></i>
Control access
Access Control
</a>
<ul class="flex-column mb-2 ul_sidebar accordion-collapse collapse" id="control-access" data-bs-parent="#sidebarMenu">
<li class="nav-item">
<a class="nav-link active2" href="#">
<a class="nav-link active2" href="{% url 'idhub:admin_roles' %}">
roles
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<a class="nav-link" href="{% url 'idhub:admin_services' %}">
Services
</a>
</li>
</ul>
</li>
<li class="nav-item">
<a class="admin nav-link fw-bold" data-bs-toggle="collapse" data-bs-target="#credentials" aria-expanded="false" aria-controls="credentials" href="javascript:void()">
<a class="admin nav-link {% if section == 'Credentials' %}active {% endif %}fw-bold" data-bs-toggle="collapse" data-bs-target="#credentials" aria-expanded="false" aria-controls="credentials" href="javascript:void()">
<i class="bi bi-patch-check icon_sidebar"></i>
Credentials
</a>
<ul class="flex-column mb-2 ul_sidebar accordion-collapse collapse" id="credentials" data-bs-parent="#sidebarMenu">
<li class="nav-item">
<a class="nav-link active2" href="#">
<a class="nav-link active2" href="{% url 'idhub:admin_credentials' %}">
Credentials list
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<a class="nav-link" href="{% url 'idhub:admin_credentials_new' %}">
Issue credentials
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<a class="nav-link" href="{% url 'idhub:admin_credentials_revoke' %}">
Revoke Credentials
</a>
</li>
@ -133,17 +133,17 @@
</a>
<ul class="flex-column mb-2 accordion-collapse collapse" id="lwallet" data-bs-parent="#wallet">
<li class="nav-item">
<a class="nav-link active2" href="#">
<a class="nav-link active2" href="{% url 'idhub:admin_wallet_identities' %}">
Identities (DID)
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<a class="nav-link" href="{% url 'idhub:admin_wallet_credentials' %}">
Credentials
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<a class="nav-link" href="{% url 'idhub:admin_wallet_config_issue' %}">
Configure Issue
</a>
</li>
@ -152,41 +152,41 @@
</ul>
</li>
<li class="nav-item">
<a class="admin nav-link fw-bold" data-bs-toggle="collapse" data-bs-target="#schemas" aria-expanded="false" aria-controls="schemas" href="javascript:void()">
<a class="admin nav-link {% if section == 'Schemes' %}active {% endif %}fw-bold" data-bs-toggle="collapse" data-bs-target="#schemes" aria-expanded="false" aria-controls="schemes" href="javascript:void()">
<i class="bi bi-file-earmark-text icon_sidebar"></i>
Schemas
Schemes
</a>
<ul class="flex-column mb-2 ul_sidebar accordion-collapse collapse" id="schemas" data-bs-parent="#sidebarMenu">
<ul class="flex-column mb-2 ul_sidebar accordion-collapse collapse" id="schemes" data-bs-parent="#sidebarMenu">
<li class="nav-item">
<a class="nav-link active2" href="#">
List of schemas
<a class="nav-link active2" href="{% url 'idhub:admin_schemes' %}">
List of schemes
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
Import schema
<a class="nav-link" href="{% url 'idhub:admin_schemes_import' %}">
Import scheme
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
Export schema
<a class="nav-link" href="{% url 'idhub:admin_schemes_export' %}">
Export scheme
</a>
</li>
</ul>
</li>
<li class="nav-item">
<a class="admin nav-link fw-bold" data-bs-toggle="collapse" data-bs-target="#import-export" aria-expanded="false" aria-controls="import-export" href="javascript:void()">
<a class="admin nav-link {% if section == 'ImportExport' %}active {% endif %}fw-bold" data-bs-toggle="collapse" data-bs-target="#import-export" aria-expanded="false" aria-controls="import-export" href="javascript:void()">
<i class="bi bi-arrow-down-square icon_sidebar"></i>
Imports/Exports
</a>
<ul class="flex-column mb-2 ul_sidebar accordion-collapse collapse" id="import-export" data-bs-parent="#sidebarMenu">
<li class="nav-item">
<a class="nav-link active2" href="#">
<a class="nav-link active2" href="{% url 'idhub:admin_import' %}">
Import
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<a class="nav-link" href="{% url 'idhub:admin_export' %}">
Export
</a>
</li>
@ -216,6 +216,10 @@
</div>
</div>
<h3>
<i class="{{ icon }}"></i>
{{ subtitle }}
</h3>
{% block content %}
{% endblock content %}

View File

@ -18,7 +18,7 @@ from django.contrib.auth import views as auth_views
from django.views.generic import RedirectView
from django.urls import path, reverse_lazy
from .views import LoginView
from .admin.views import AdminDashboardView
from .admin import views as views_admin
from .user import views as views_user
@ -29,8 +29,6 @@ urlpatterns = [
permanent=False)),
path('login/', LoginView.as_view(), name='login'),
path('logout/', auth_views.LogoutView.as_view(), name='logout'),
path('admin/dashboard/', AdminDashboardView.as_view(),
name='admin_dashboard'),
# User
path('user/dashboard/', views_user.UserDashboardView.as_view(),
@ -51,4 +49,40 @@ urlpatterns = [
path('user/credentials_presentation/',
views_user.UserCredentialsPresentationView.as_view(),
name='user_credentials_presentation'),
# Admin
path('admin/dashboard/', views_admin.AdminDashboardView.as_view(),
name='admin_dashboard'),
path('admin/people/', views_admin.AdminPeopleView.as_view(),
name='admin_people'),
path('admin/people/new/', views_admin.AdminPeopleRegisterView.as_view(),
name='admin_people_new'),
path('admin/roles/', views_admin.AdminRolesView.as_view(),
name='admin_roles'),
path('admin/services/', views_admin.AdminServicesView.as_view(),
name='admin_services'),
path('admin/credentials/', views_admin.AdminCredentialsView.as_view(),
name='admin_credentials'),
path('admin/credentials/new/', views_admin.AdminIssueCredentialsView.as_view(),
name='admin_credentials_new'),
path('admin/credentials/revoke/', views_admin.AdminRevokeCredentialsView.as_view(),
name='admin_credentials_revoke'),
path('admin/wallet/identities/', views_admin.AdminWalletIdentitiesView.as_view(),
name='admin_wallet_identities'),
path('admin/wallet/credentials/', views_admin.AdminWalletCredentialsView.as_view(),
name='admin_wallet_credentials'),
path('admin/wallet/config/issue/', views_admin.AdminWalletConfigIssuesView.as_view(),
name='admin_wallet_config_issue'),
path('admin/wallet/config/issue/', views_admin.AdminWalletConfigIssuesView.as_view(),
name='admin_wallet_config_issue'),
path('admin/schemes/', views_admin.AdminSchemesView.as_view(),
name='admin_schemes'),
path('admin/schemes/import', views_admin.AdminSchemesImportView.as_view(),
name='admin_schemes_import'),
path('admin/schemes/export/', views_admin.AdminSchemesExportView.as_view(),
name='admin_schemes_export'),
path('admin/import', views_admin.AdminImportView.as_view(),
name='admin_import'),
path('admin/export/', views_admin.AdminExportView.as_view(),
name='admin_export'),
]