add admin credentials view
This commit is contained in:
parent
2ca1663e90
commit
028770a52c
|
@ -412,10 +412,23 @@ class AdminCredentialsView(Credentials):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
class AdminIssueCredentialsView(Credentials):
|
class AdminCredentialView(Credentials):
|
||||||
template_name = "idhub/admin/issue_credentials.html"
|
template_name = "idhub/admin/issue_credentials.html"
|
||||||
subtitle = _('Issuance of Credentials')
|
subtitle = _('Change status of Credential')
|
||||||
icon = ''
|
icon = ''
|
||||||
|
model = VerificableCredential
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
class AdminRevokeCredentialsView(Credentials):
|
class AdminRevokeCredentialsView(Credentials):
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<td>{{ f.issue_on }}</td>
|
<td>{{ f.issue_on }}</td>
|
||||||
<td>{{ f.get_status }}</td>
|
<td>{{ f.get_status }}</td>
|
||||||
<td>{{ f.user.email }}</td>
|
<td>{{ f.user.email }}</td>
|
||||||
<td><button type="button" class="btn btn-green-admin">{% trans 'View' %}</button></td>
|
<td><a href="{% url 'idhub:admin_credential' f.id %}" class="btn btn-green-admin">{% trans 'View' %}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -2,8 +2,60 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h3>
|
<div class="row">
|
||||||
<i class="{{ icon }}"></i>
|
<div class="col">
|
||||||
{{ subtitle }}
|
<h3>
|
||||||
</h3>
|
<i class="{{ icon }}"></i>
|
||||||
|
{{ subtitle }}
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="col text-end">
|
||||||
|
{% if object.get_status == 'Issued' %}
|
||||||
|
<a class="btn btn-yellow" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'Revoke' %}</a>
|
||||||
|
<a class="btn btn-orange" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'Delete' %}</a>
|
||||||
|
{% elif object.get_status == 'Required' %}
|
||||||
|
<a class="btn btn-yellow" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'Accept' %}</a>
|
||||||
|
<a class="btn btn-orange" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'Deny' %}</a>
|
||||||
|
{% elif object.get_status == 'Issued' %}
|
||||||
|
<a class="btn btn-yellow" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'Revoke' %}</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-3">
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
{% for k, v in object.get_datas %}
|
||||||
|
<div class="row mt-3">
|
||||||
|
<div class="col-3 text-end">
|
||||||
|
<strong>{{ k|capfirst }}:</strong>
|
||||||
|
</div>
|
||||||
|
<div class="col bg-light text-secondary">
|
||||||
|
{{ v }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
<div class="row mt-3">
|
||||||
|
<div class="col-3 text-end">
|
||||||
|
<strong>Date of Issue:</strong>
|
||||||
|
</div>
|
||||||
|
<div class="col bg-light text-secondary">
|
||||||
|
{{ object.issuer_on|default_if_none:"" }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mt-3">
|
||||||
|
<div class="col-3 text-end">
|
||||||
|
<strong>Status:</strong>
|
||||||
|
</div>
|
||||||
|
<div class="col bg-light text-secondary">
|
||||||
|
{{ object.get_status}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mt-3">
|
||||||
|
<div class="col text-center">
|
||||||
|
<a class="btn btn-green-user" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'View in JSON format' %}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -136,8 +136,8 @@ urlpatterns = [
|
||||||
name='admin_service_del'),
|
name='admin_service_del'),
|
||||||
path('admin/credentials/', views_admin.AdminCredentialsView.as_view(),
|
path('admin/credentials/', views_admin.AdminCredentialsView.as_view(),
|
||||||
name='admin_credentials'),
|
name='admin_credentials'),
|
||||||
path('admin/credentials/new/', views_admin.AdminIssueCredentialsView.as_view(),
|
path('admin/credentials/<int:pk>/', views_admin.AdminCredentialView.as_view(),
|
||||||
name='admin_credentials_new'),
|
name='admin_credential'),
|
||||||
path('admin/credentials/revoke/', views_admin.AdminRevokeCredentialsView.as_view(),
|
path('admin/credentials/revoke/', views_admin.AdminRevokeCredentialsView.as_view(),
|
||||||
name='admin_credentials_revoke'),
|
name='admin_credentials_revoke'),
|
||||||
path('admin/wallet/identities/', views_admin.AdminDidsView.as_view(),
|
path('admin/wallet/identities/', views_admin.AdminDidsView.as_view(),
|
||||||
|
|
Loading…
Reference in a new issue