add management views, forms, and templates for Gatekeeper IP addresses

This commit is contained in:
Eduardo Silva
2026-03-12 09:58:08 -03:00
parent 7119eacef1
commit cecdb7b0fa
4 changed files with 166 additions and 3 deletions

View File

@@ -24,6 +24,12 @@
{% 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">
@@ -235,6 +241,58 @@
{% 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>