Files
wireguard_webadmin/templates/gatekeeper/gatekeeper_list.html

303 lines
16 KiB
HTML
Raw Normal View History

{% extends "base.html" %}
{% load i18n %}
{% block content %}
<div class="card card-primary card-outline">
<div class="card-body">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link {% if active_tab == 'users' or active_tab == 'groups' %}active{% endif %}"
href="{% url 'gatekeeper_list' %}?tab=users" role="tab">
{% trans 'Gatekeeper Users' %}
</a>
</li>
<li class="nav-item">
<a class="nav-link {% if active_tab == 'auth_methods' %}active{% endif %}"
href="{% url 'gatekeeper_list' %}?tab=auth_methods" role="tab">
{% trans 'Authentication Methods' %}
</a>
</li>
<li class="nav-item">
<a class="nav-link {% if active_tab == 'allowed_identities' %}active{% endif %}"
href="{% url 'gatekeeper_list' %}?tab=allowed_identities" role="tab">
{% trans 'Allowed Emails & Domains' %}
</a>
</li>
<li class="nav-item">
<a class="nav-link {% if active_tab == 'ip_addresses' %}active{% endif %}"
href="{% url 'gatekeeper_list' %}?tab=ip_addresses" role="tab">
{% trans 'IP Addresses' %}
</a>
</li>
</ul>
<div class="tab-content mt-4">
{% if active_tab == 'users' or active_tab == 'groups' %}
<div class="mb-3">
<div class="btn-group mb-3">
<a href="{% url 'gatekeeper_list' %}?tab=users" class="btn {% if active_tab == 'users' %}btn-primary{% else %}btn-outline-primary{% endif %}">
{% trans 'Users' %}
</a>
<a href="{% url 'gatekeeper_list' %}?tab=groups" class="btn {% if active_tab == 'groups' %}btn-primary{% else %}btn-outline-primary{% endif %}">
{% trans 'Groups' %}
</a>
</div>
</div>
{% if active_tab == 'users' %}
<div class="mb-3">
<a href="{% url 'manage_gatekeeper_user' %}" class="btn btn-outline-primary btn-sm">
<i class="fas fa-plus"></i> {% trans 'Add User' %}
</a>
</div>
{% if users %}
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>{% trans 'Username' %}</th>
<th>{% trans 'Email' %}</th>
<th>{% trans 'Actions' %}</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.username }}</td>
<td>{{ user.email }}</td>
<td style="width: 15%">
<a href="{% url 'manage_gatekeeper_user' %}?uuid={{ user.uuid }}"
class="btn btn-sm btn-info" title="{% trans 'Edit' %}">
<i class="fas fa-edit"></i>
</a>
<a href="{% url 'delete_gatekeeper_user' %}?uuid={{ user.uuid }}"
class="btn btn-sm btn-danger" title="{% trans 'Delete' %}">
<i class="fas fa-trash"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-info">
{% trans 'No Gatekeeper Users found.' %}
</div>
{% endif %}
{% elif active_tab == 'groups' %}
<div class="mb-3">
<a href="{% url 'manage_gatekeeper_group' %}" class="btn btn-outline-primary btn-sm">
<i class="fas fa-plus"></i> {% trans 'Add Group' %}
</a>
</div>
{% if groups %}
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>{% trans 'Group Name' %}</th>
<th>{% trans 'Members' %}</th>
<th>{% trans 'Actions' %}</th>
</tr>
</thead>
<tbody>
{% for group in groups %}
<tr>
<td>{{ group.name }}</td>
<td>{{ group.users.count }}</td>
<td style="width: 15%">
<a href="{% url 'manage_gatekeeper_group' %}?uuid={{ group.uuid }}"
class="btn btn-sm btn-info" title="{% trans 'Edit' %}">
<i class="fas fa-edit"></i>
</a>
<a href="{% url 'delete_gatekeeper_group' %}?uuid={{ group.uuid }}"
class="btn btn-sm btn-danger" title="{% trans 'Delete' %}">
<i class="fas fa-trash"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-info">
{% trans 'No Gatekeeper Groups found.' %}
</div>
{% endif %}
{% endif %}
{% elif active_tab == 'auth_methods' %}
<div class="mb-3">
<a href="{% url 'manage_gatekeeper_auth_method' %}" class="btn btn-primary">
<i class="fas fa-plus"></i> {% trans 'Add Auth Method' %}
</a>
</div>
{% if auth_methods %}
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>{% trans 'Name' %}</th>
<th>{% trans 'Type' %}</th>
<th>{% trans 'Actions' %}</th>
</tr>
</thead>
<tbody>
{% for method in auth_methods %}
<tr>
<td>{{ method.name }}</td>
<td>{{ method.get_auth_type_display }}</td>
<td style="width: 15%">
<a href="{% url 'manage_gatekeeper_auth_method' %}?uuid={{ method.uuid }}"
class="btn btn-sm btn-info" title="{% trans 'Edit' %}">
<i class="fas fa-edit"></i>
</a>
<a href="{% url 'delete_gatekeeper_auth_method' %}?uuid={{ method.uuid }}"
class="btn btn-sm btn-danger" title="{% trans 'Delete' %}">
<i class="fas fa-trash"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-info">
{% trans 'No Authentication Methods found.' %}
</div>
{% endif %}
{% elif active_tab == 'allowed_identities' %}
<div class="mb-3">
<a href="{% url 'manage_gatekeeper_email' %}" class="btn btn-primary">
<i class="fas fa-plus"></i> {% trans 'Add Allowed Email' %}
</a>
<a href="{% url 'manage_gatekeeper_domain' %}" class="btn btn-primary">
<i class="fas fa-plus"></i> {% trans 'Add Allowed Domain' %}
</a>
</div>
{% if auth_emails or auth_domains %}
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>{% trans 'Type' %}</th>
<th>{% trans 'Identity' %}</th>
<th>{% trans 'Auth Method' %}</th>
<th>{% trans 'Actions' %}</th>
</tr>
</thead>
<tbody>
{% for email in auth_emails %}
<tr>
<td><span class="badge badge-info">{% trans 'Email' %}</span></td>
<td>{{ email.email }}</td>
<td>{{ email.auth_method.name }}</td>
<td style="width: 15%">
<a href="{% url 'manage_gatekeeper_email' %}?uuid={{ email.uuid }}"
class="btn btn-sm btn-info" title="{% trans 'Edit' %}">
<i class="fas fa-edit"></i>
</a>
<a href="{% url 'delete_gatekeeper_email' %}?uuid={{ email.uuid }}"
class="btn btn-sm btn-danger" title="{% trans 'Delete' %}">
<i class="fas fa-trash"></i>
</a>
</td>
</tr>
{% endfor %}
{% for domain in auth_domains %}
<tr>
<td><span class="badge badge-secondary">{% trans 'Domain' %}</span></td>
<td>{{ domain.domain }}</td>
<td>{{ domain.auth_method.name }}</td>
<td style="width: 15%">
<a href="{% url 'manage_gatekeeper_domain' %}?uuid={{ domain.uuid }}"
class="btn btn-sm btn-info" title="{% trans 'Edit' %}">
<i class="fas fa-edit"></i>
</a>
<a href="{% url 'delete_gatekeeper_domain' %}?uuid={{ domain.uuid }}"
class="btn btn-sm btn-danger" title="{% trans 'Delete' %}">
<i class="fas fa-trash"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-info">
{% trans 'No Allowed Emails or Domains found.' %}
</div>
{% endif %}
{% elif active_tab == 'ip_addresses' %}
<div class="mb-3">
<a href="{% url 'manage_gatekeeper_ip' %}" class="btn btn-primary">
<i class="fas fa-plus"></i> {% trans 'Add IP Address' %}
</a>
</div>
{% if auth_ips %}
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>{% trans 'IP Address' %}</th>
<th>{% trans 'Prefix Length' %}</th>
<th>{% trans 'Action' %}</th>
<th>{% trans 'Auth Method' %}</th>
<th>{% trans 'Manage' %}</th>
</tr>
</thead>
<tbody>
{% for ip in auth_ips %}
<tr>
<td>{{ ip.address }}</td>
<td>{% if ip.prefix_length %}/{{ ip.prefix_length }}{% endif %}</td>
<td>
{% if ip.action == 'allow' %}
<span class="badge badge-success">{% trans 'Allow' %}</span>
{% else %}
<span class="badge badge-danger">{% trans 'Deny' %}</span>
{% endif %}
</td>
<td>{{ ip.auth_method.name }}</td>
<td style="width: 15%">
<a href="{% url 'manage_gatekeeper_ip' %}?uuid={{ ip.uuid }}"
class="btn btn-sm btn-info" title="{% trans 'Edit' %}">
<i class="fas fa-edit"></i>
</a>
<a href="{% url 'delete_gatekeeper_ip' %}?uuid={{ ip.uuid }}"
class="btn btn-sm btn-danger" title="{% trans 'Delete' %}">
<i class="fas fa-trash"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-info">
{% trans 'No IP Addresses found.' %}
</div>
{% endif %}
{% endif %}
</div>
</div>
</div>
{% endblock %}