Add user permissions for reload and restart

This commit is contained in:
Eduardo Silva
2025-04-11 11:05:20 -03:00
parent b140362e86
commit a58d233546
9 changed files with 114 additions and 23 deletions

View File

@@ -251,16 +251,26 @@
Your WireGuard settings have been modified. To apply these changes, please update the configuration and reload the WireGuard service.
</p>
<p>
<a href="/tools/export_wireguard_config/?action=update_and_restart" class="btn btn-secondary">Update and restart service</a>
<a href="/tools/export_wireguard_config/?action=update_and_reload" class="btn btn-secondary">Update and reload service</a>
<a
{% if user_acl.enable_restart %}
href="/tools/export_wireguard_config/?action=update_and_restart" class="btn btn-secondary"
{% else %}
href="#" class="btn btn-secondary disabled"
{% endif %}
>Update and restart service</a>
<a
{% if user_acl.enable_reload %}
href="/tools/export_wireguard_config/?action=update_and_reload" class="btn btn-secondary"
{% else %}
href="#" class="btn btn-secondary disabled"
{% endif %}
>Update and reload service</a>
</p>
</div>
{% endif %}
{% block content %}{% endblock %}
</div><!-- /.container-fluid -->
</section>

View File

@@ -1,15 +1,14 @@
{% extends "base.html" %}
{% block content %}
<table class="table table-striped">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Username</th>
<th>User Level</th>
<th>Peer Groups</th>
<th></th>
<th></th>
<th></th>
<th colspan="4">Permissions</th>
<th><i class="far fa-edit"></i></th>
</tr>
</thead>
<tbody>
@@ -26,16 +25,29 @@
Any
{% endif %}
</td>
<td style="width: 1%; white-space: nowrap;">
{% if user_acl.enable_restart %}
<i class="fas fa-power-off" title="Restart Enabled"></i>
{% endif %}
</td>
<td style="width: 1%; white-space: nowrap;">
{% if user_acl.enable_reload %}
<i class="fas fa-sync-alt" title="Reload Enabled"></i>
{% endif %}
</td>
<td style="width: 1%; white-space: nowrap;">
{% if user_acl.enable_console %}
<i class="fas fa-terminal" title="Console Enabled"></i>
{% endif %}
</td>
<td style="width: 1%; white-space: nowrap;">
{% if user_acl.enable_enhanced_filter %}
<i class="fas fa-eye-slash" title="Enhanced Filter Enabled"></i>
{% endif %}
</td>
<td style="width: 1%; white-space: nowrap;">
<a href="/user/manage/?uuid={{ user_acl.uuid }}" ><i class="far fa-edit"></i></a>
</td>

View File

@@ -7,8 +7,21 @@
<div class="card card-primary card-outline">
<div class="card-header">
<a href='/tools/export_wireguard_config/' class='btn btn-outline-primary'>Update Configuration</a>
<a href='/tools/restart_wireguard/' class='btn btn-outline-primary'>Restart Wireguard service</a>
<a href='/tools/restart_wireguard/?mode=reload' class='btn btn-outline-primary'>Reload Wireguard service</a>
<a
{% if user_acl.enable_restart %}
href='/tools/restart_wireguard/' class='btn btn-outline-primary'
{% else %}
href='#' class='btn btn-outline-primary disabled'
{% endif %}
>Restart Wireguard service</a>
<a
{% if user_acl.enable_reload %}
href='/tools/restart_wireguard/?mode=reload' class='btn btn-outline-primary'
{% else %}
href='#' class='btn btn-outline-primary disabled'
{% endif %}
>Reload Wireguard service</a>
<div class="btn-group float-right" role="group" aria-label="Graph interval">
<a href="?period=6h" data-period="6h" class="btn btn-outline-primary">6h</a>