mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2026-03-17 14:26:18 +00:00
add reserved application checks to prevent modification and deletion
This commit is contained in:
@@ -145,7 +145,7 @@
|
||||
<tbody>
|
||||
{% for policy in access_policies %}
|
||||
<tr>
|
||||
<td>{{ policy }}</td>
|
||||
<td>{{ policy.display_name|default:policy.name }}</td>
|
||||
<td>{{ policy.get_policy_type_display }}</td>
|
||||
<td>{{ policy.groups.count }}</td>
|
||||
<td>{{ policy.methods.count }}</td>
|
||||
|
||||
@@ -11,12 +11,21 @@
|
||||
<a href="{% url 'app_gateway_list' %}" class="btn btn-sm btn-secondary">
|
||||
<i class="fas fa-arrow-left"></i> {% trans 'Back to List' %}
|
||||
</a>
|
||||
{% if is_reserved %}
|
||||
<a class="btn btn-sm btn-secondary disabled" aria-disabled="true" tabindex="-1" title="{% trans 'This application cannot be modified' %}">
|
||||
<i class="fas fa-edit"></i> {% trans 'Edit Application' %}
|
||||
</a>
|
||||
<a class="btn btn-sm btn-secondary disabled" aria-disabled="true" tabindex="-1" title="{% trans 'This application cannot be deleted' %}">
|
||||
<i class="fas fa-trash"></i> {% trans 'Delete Application' %}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{% url 'manage_application' %}?uuid={{ application.uuid }}" class="btn btn-sm btn-info">
|
||||
<i class="fas fa-edit"></i> {% trans 'Edit Application' %}
|
||||
</a>
|
||||
<a href="{% url 'delete_application' %}?uuid={{ application.uuid }}" class="btn btn-sm btn-danger">
|
||||
<i class="fas fa-trash"></i> {% trans 'Delete Application' %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@@ -46,10 +55,16 @@
|
||||
|
||||
<h4 id="hosts">{% trans 'Application Hosts' %}</h4>
|
||||
<div class="mb-3">
|
||||
{% if is_reserved %}
|
||||
<a class="btn btn-outline-secondary btn-sm disabled" aria-disabled="true" tabindex="-1" title="{% trans 'This application cannot be modified' %}">
|
||||
<i class="fas fa-plus"></i> {% trans 'Add Host' %}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{% url 'manage_application_host' %}?application_uuid={{ application.uuid }}"
|
||||
class="btn btn-outline-primary btn-sm">
|
||||
<i class="fas fa-plus"></i> {% trans 'Add Host' %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if hosts %}
|
||||
@@ -66,6 +81,14 @@
|
||||
<tr>
|
||||
<td>{{ host.hostname }}</td>
|
||||
<td style="width: 15%">
|
||||
{% if is_reserved %}
|
||||
<a class="btn btn-sm btn-secondary disabled" aria-disabled="true" tabindex="-1" title="{% trans 'This application cannot be modified' %}">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<a class="btn btn-sm btn-secondary disabled" aria-disabled="true" tabindex="-1" title="{% trans 'This application cannot be modified' %}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{% url 'manage_application_host' %}?uuid={{ host.uuid }}"
|
||||
class="btn btn-sm btn-info" title="{% trans 'Edit' %}">
|
||||
<i class="fas fa-edit"></i>
|
||||
@@ -74,6 +97,7 @@
|
||||
class="btn btn-sm btn-danger" title="{% trans 'Delete' %}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user