2026-03-12 09:22:00 -03:00
{% extends "base.html" %}
2026-11-21 16:43:06 -03:00
{% load i18n static %}
{% block page_custom_head %}
{% if active_tab == 'sessions' and gateway_sessions %}
< link rel = "stylesheet" href = "{% static 'AdminLTE-3.2.0/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css' %}" >
< link rel = "stylesheet" href = "{% static 'AdminLTE-3.2.0/plugins/datatables-buttons/css/buttons.bootstrap4.min.css' %}" >
< style >
/* The column menu of DataTables Buttons has no dark mode of its own */
. dark-mode div . dt-button-collection {
background-color : #343a40 ;
border-color : #6c757d ;
}
. dark-mode div . dt-button-collection . dropdown-item : not ( . active ) : hover {
background-color : #495057 ;
}
</ style >
{% endif %}
{% endblock %}
2026-03-12 09:22:00 -03:00
{% block content %}
2026-03-17 15:43:21 -03:00
{% include 'app_gateway/caddy_disabled_alert.html' %}
2026-11-18 18:00:06 -03:00
{% include 'app_gateway/pending_export_alert.html' %}
2026-03-12 09:22:00 -03:00
< 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 == 'auth_methods' %}active{% endif %}"
href = "{% url 'gatekeeper_list' %}?tab=auth_methods" role = "tab" >
{% trans 'Authentication Methods' %}
</ a >
</ li >
< li class = "nav-item" >
2026-03-12 15:22:58 -03:00
< 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" >
2026-03-12 09:22:00 -03:00
< 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 >
2026-03-12 09:58:08 -03:00
< 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 >
2026-11-21 16:43:06 -03:00
< li class = "nav-item" >
< a class = "nav-link {% if active_tab == 'sessions' %}active{% endif %}"
href = "{% url 'gatekeeper_list' %}?tab=sessions" role = "tab" >
{% trans 'Sessions' %}
</ a >
</ li >
2026-03-12 09:22:00 -03:00
</ 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 >
2026-03-15 17:20:18 -03:00
< th > {% trans 'TOTP' %}</ th >
< th > {% trans 'Groups' %}</ th >
2026-03-12 09:22:00 -03:00
< th > {% trans 'Actions' %}</ th >
</ tr >
</ thead >
< tbody >
{% for user in users %}
< tr >
< td > {{ user.username }}</ td >
< td > {{ user.email }}</ td >
2026-03-15 17:20:18 -03:00
< td >
{% if user.totp_secret %}
< span class = "badge badge-success" >< i class = "fas fa-check" ></ i > {% trans 'Yes' %}</ span >
{% else %}
< span class = "badge badge-secondary" > {% trans 'No' %}</ span >
{% endif %}
</ td >
< td >
{% for group in user.groups.all %}
2026-03-16 16:33:12 -03:00
< span class = "badge badge-info" > {{ group }}</ span >
2026-03-15 17:20:18 -03:00
{% empty %}
< span class = "text-muted" > —</ span >
{% endfor %}
</ td >
2026-03-12 09:22:00 -03:00
< td style = "width: 15%" >
2026-03-15 17:20:18 -03:00
< a href = "{% url 'manage_gatekeeper_user' %}?uuid={{ user.uuid }}"
2026-03-12 09:22:00 -03:00
class = "btn btn-sm btn-info" title = "{% trans 'Edit' %}" >
< i class = "fas fa-edit" ></ i >
</ a >
2026-03-15 17:20:18 -03:00
< a href = "{% url 'delete_gatekeeper_user' %}?uuid={{ user.uuid }}"
2026-03-12 09:22:00 -03:00
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 >
2026-03-16 16:33:12 -03:00
< td > {{ group }}</ td >
2026-03-12 09:22:00 -03:00
< 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 >
2026-03-16 16:33:12 -03:00
< td > {{ method }}</ td >
2026-03-12 09:22:00 -03:00
< 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 >
2026-03-16 16:33:12 -03:00
< td > {{ email.auth_method }}</ td >
2026-03-12 09:22:00 -03:00
< 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 >
2026-03-16 16:33:12 -03:00
< td > {{ domain.auth_method }}</ td >
2026-03-12 09:22:00 -03:00
< 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 %}
2026-03-12 09:58:08 -03:00
{% 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 >
2026-03-16 16:33:12 -03:00
< td > {{ ip.auth_method }}</ td >
2026-03-12 09:58:08 -03:00
< 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 %}
2026-11-21 16:43:06 -03:00
{% elif active_tab == 'sessions' %}
< p class = "text-muted" >
{% trans 'Sessions opened on the App Gateway login. A session is online when it was used in the last 10 minutes. Sessions of cluster workers are the last ones each worker reported.' %}
</ p >
{% if gateway_sessions %}
< table id = "gateway-sessions-table" class = "table table-striped table-hover w-100" >
< thead >
< tr >
< th > {% trans 'User' %}</ th >
< th > {% trans 'Server' %}</ th >
< th > {% trans 'Host' %}</ th >
< th > {% trans 'Last access' %}</ th >
< th > {% trans 'IP Address' %}</ th >
< th > {% trans 'Factors' %}</ th >
< th > {% trans 'Started' %}</ th >
< th > {% trans 'Expires' %}</ th >
< th > {% trans 'Browser' %}</ th >
< th class = "no-colvis" > {% trans 'Manage' %}</ th >
</ tr >
</ thead >
< tbody >
{% for session in gateway_sessions %}
< tr >
< td data-order = "{{ session.username|default:session.email|lower }}" >
{{ session.username|default:session.email|default:'-' }}
{% if session.username and session.email %}< br >< small class = "text-muted" > {{ session.email }}</ small > {% endif %}
</ td >
< td data-order = "{{ session.server_name|default:'' }}" >
{{ session.server_name|default:_('Primary Server') }}
{% if session.stale %}< br >< span class = "badge badge-secondary" title = "{% trans 'Last report' %}: {{ session.reported_at|date:'SHORT_DATETIME_FORMAT' }}" > {% trans 'Worker offline' %}</ span > {% endif %}
</ td >
< td > {{ session.host|default:'-' }}</ td >
< td data-order = "{% if session.online %}9999-12-31{% else %}{{ session.last_seen|default:'' }}{% endif %}" >
{% if session.online %}
< span class = "badge badge-success" > {% trans 'Online' %}</ span >
{% else %}
{{ session.last_seen_at|date:'SHORT_DATETIME_FORMAT'|default:'-' }}
{% endif %}
</ td >
< td data-order = "{{ session.client_ip_order }}" > {{ session.client_ip|default:'-' }}</ td >
< td > {{ session.factors|join:', '|default:'-' }}</ td >
< td data-order = "{{ session.created_at|default:'' }}" > {{ session.created|date:'SHORT_DATETIME_FORMAT' }}</ td >
< td data-order = "{{ session.expires_at|default:'' }}" > {{ session.expires|date:'SHORT_DATETIME_FORMAT' }}</ td >
< td >< small title = "{{ session.user_agent }}" > {{ session.user_agent|truncatechars:60|default:'-' }}</ small ></ td >
< td class = "text-nowrap" >
{% if session.revoking %}
< span class = "badge badge-warning" > {% trans 'Ending' %}</ span >
{% else %}
< form method = "post" action = "{% url 'revoke_gatekeeper_session' %}" class = "d-inline" >
{% csrf_token %}
< input type = "hidden" name = "session" value = "{{ session.id }}" >
< button type = "submit" class = "btn btn-sm btn-danger" title = "{% trans 'End session' %}" >
< i class = "fas fa-sign-out-alt" ></ i >
</ button >
</ form >
{% endif %}
</ td >
</ tr >
{% endfor %}
</ tbody >
</ table >
{% else %}
< div class = "alert alert-info" >
{% trans 'No active sessions.' %}
</ div >
{% endif %}
2026-03-12 09:22:00 -03:00
{% endif %}
</ div >
</ div >
</ div >
{% endblock %}
2026-11-21 16:43:06 -03:00
{% block custom_page_scripts %}
{% if active_tab == 'sessions' and gateway_sessions %}
< script src = "{% static 'AdminLTE-3.2.0/plugins/datatables/jquery.dataTables.min.js' %}" ></ script >
< script src = "{% static 'AdminLTE-3.2.0/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js' %}" ></ script >
< script src = "{% static 'AdminLTE-3.2.0/plugins/datatables-buttons/js/dataTables.buttons.min.js' %}" ></ script >
< script src = "{% static 'AdminLTE-3.2.0/plugins/datatables-buttons/js/buttons.bootstrap4.min.js' %}" ></ script >
< script src = "{% static 'AdminLTE-3.2.0/plugins/datatables-buttons/js/buttons.colVis.min.js' %}" ></ script >
< script >
$ ( function () {
$ ( '#gateway-sessions-table' ). DataTable ({
// Visible columns and sorting chosen by the user are kept in this browser
stateSave : true ,
stateDuration : 0 ,
stateSaveParams : function ( settings , data ) {
data . search . search = '' ;
data . start = 0 ;
},
order : [[ 3 , 'desc' ], [ 0 , 'asc' ]],
pageLength : 25 ,
autoWidth : false ,
columnDefs : [
{ targets : [ 4 , 5 , 6 , 7 , 8 ], visible : false },
{ targets : 9 , orderable : false , searchable : false },
],
dom : "<'row'<'col-sm-12 col-md-6'B><'col-sm-12 col-md-6'f>>" +
"<'row'<'col-sm-12 table-responsive'tr>>" +
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>" ,
buttons : [
{ extend : 'colvis' , text : '<i class="fas fa-columns"></i> {% trans "Columns"|escapejs %}' , columns : ':not(.no-colvis)' },
],
language : {
search : '{% trans "Search:"|escapejs %}' ,
info : '{% trans "Showing _START_ to _END_ of _TOTAL_ sessions"|escapejs %}' ,
infoEmpty : '{% trans "No sessions to show"|escapejs %}' ,
infoFiltered : '{% trans "(filtered from _MAX_ sessions)"|escapejs %}' ,
zeroRecords : '{% trans "No matching sessions"|escapejs %}' ,
paginate : { previous : '{% trans "Previous"|escapejs %}' , next : '{% trans "Next"|escapejs %}' },
},
});
});
</ script >
{% endif %}
{% endblock %}