| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- {% extends "admin/base.html" %}
- {% block content %}
- <div class="bg-white rounded-lg shadow-lg p-4 sm:p-6">
- <div class="flex justify-between items-center mb-4 sm:mb-6">
- <div>
- <h2 class="text-xl sm:text-2xl font-bold text-gray-800">{{ _("Gestión de Access Control Lists (ACLs)") }}</h2>
- <p class="text-sm text-gray-600 mt-1">{{ _("Define condiciones para controlar el acceso al proxy") }}</p>
- </div>
- <button onclick="showAddModal()" class="bg-blue-600 hover:bg-blue-700 text-white font-semibold px-4 py-2 rounded-lg shadow-md transition-colors">
- <i class="fas fa-plus mr-2"></i>{{ _("Agregar ACL") }}
- </button>
- </div>
-
- <!-- RC -->
- <div class="mb-6 bg-red-50 border-2 border-red-300 rounded-lg p-6 flex items-start space-x-4">
- <i class="fas fa-exclamation-triangle text-red-600 text-3xl mt-1 animate-pulse"></i>
- <div class="flex-1">
- <p class="font-bold text-red-800 text-lg">{{ _("¡MUY IMPORTANTE!") }}</p>
- <p class="text-red-700 mt-2 font-medium">
- {{ _("Esta funcionalidad se encuentra en") }} <strong>{{ _("RC") }}</strong>. Puede contener errores y comportamientos inesperados.
- </p>
- <p class="text-red-700 mt-2">
- <strong>{{ _("Por favor, no la uses en producción de momento. Úsala únicamente en un entorno de prueba.") }}</strong>
- </p>
- </div>
- </div>
-
- {% if acls %}
- <div class="mb-4 bg-blue-50 border border-blue-200 rounded-lg p-4">
- <div class="flex items-start">
- <i class="fas fa-info-circle text-blue-600 mt-1 mr-3"></i>
- <div class="text-sm text-gray-700">
- <p class="font-semibold text-gray-800 mb-1">{{ _("Acerca de las ACLs:") }}</p>
- <ul class="list-disc list-inside space-y-1 ml-2">
- <li><span class="font-mono text-xs bg-white px-1 rounded">{{ _("[fast]") }}</span> {{ _("ACLs rápidas - no requieren lookups externos") }}</li>
- <li><span class="font-mono text-xs bg-orange-100 px-1 rounded">{{ _("[slow]") }}</span> {{ _("ACLs lentas - pueden requerir DNS o autenticación") }}</li>
- <li>{{ _("Usa las ACLs en reglas de http_access, http_reply_access, etc.") }}</li>
- <li>{{ _("ACLs predefinidas:") }} <code class="bg-white px-1 rounded">{{ _("all, manager, localhost, to_localhost, to_linklocal, CONNECT") }}</code></li>
- </ul>
- </div>
- </div>
- </div>
- <div class="space-y-2">
- {% for acl in acls %}
- <div class="flex flex-col sm:flex-row items-start justify-between p-4 bg-gradient-to-r from-gray-50 to-white rounded-lg border border-gray-200 hover:border-gray-300 transition-all gap-3">
- <div class="flex items-start space-x-3 flex-1 min-w-0 w-full">
- <div class="flex flex-col items-center space-y-1 flex-shrink-0">
- {% if acl.is_predefined %}
- <span class="inline-flex px-2 py-1 text-xs font-bold rounded-full bg-purple-100 text-purple-800 border border-purple-300">
- <i class="fas fa-star mr-1"></i>{{ _("BUILT-IN") }}
- </span>
- {% endif %}
-
- {% if acl.category == 'network' %}
- <div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center">
- <i class="fas fa-network-wired text-blue-600"></i>
- </div>
- {% elif acl.category == 'domain' %}
- <div class="w-10 h-10 rounded-full bg-green-100 flex items-center justify-center">
- <i class="fas fa-globe text-green-600"></i>
- </div>
- {% elif acl.category == 'time' %}
- <div class="w-10 h-10 rounded-full bg-orange-100 flex items-center justify-center">
- <i class="fas fa-clock text-orange-600"></i>
- </div>
- {% elif acl.category == 'url' %}
- <div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center">
- <i class="fas fa-link text-indigo-600"></i>
- </div>
- {% elif acl.category == 'port' %}
- <div class="w-10 h-10 rounded-full bg-cyan-100 flex items-center justify-center">
- <i class="fas fa-plug text-cyan-600"></i>
- </div>
- {% elif acl.category == 'protocol' %}
- <div class="w-10 h-10 rounded-full bg-teal-100 flex items-center justify-center">
- <i class="fas fa-exchange-alt text-teal-600"></i>
- </div>
- {% elif acl.category == 'auth' %}
- <div class="w-10 h-10 rounded-full bg-red-100 flex items-center justify-center">
- <i class="fas fa-user-lock text-red-600"></i>
- </div>
- {% elif acl.category == 'content' %}
- <div class="w-10 h-10 rounded-full bg-yellow-100 flex items-center justify-center">
- <i class="fas fa-file-alt text-yellow-600"></i>
- </div>
- {% elif acl.category == 'ssl' %}
- <div class="w-10 h-10 rounded-full bg-emerald-100 flex items-center justify-center">
- <i class="fas fa-lock text-emerald-600"></i>
- </div>
- {% elif acl.category == 'connection' %}
- <div class="w-10 h-10 rounded-full bg-pink-100 flex items-center justify-center">
- <i class="fas fa-server text-pink-600"></i>
- </div>
- {% else %}
- <div class="w-10 h-10 rounded-full bg-gray-100 flex items-center justify-center">
- <i class="fas fa-cog text-gray-600"></i>
- </div>
- {% endif %}
- </div>
-
- <div class="flex-1 min-w-0">
- <div class="flex items-center gap-2 mb-2">
- <h3 class="text-lg font-bold text-gray-800">{{ acl.name }}</h3>
- <span class="inline-flex px-2 py-0.5 text-xs font-semibold rounded bg-gray-100 text-gray-700 border border-gray-300">
- {{ acl.type }}
- </span>
- {% if acl.is_slow %}
- <span class="inline-flex px-2 py-0.5 text-xs font-semibold rounded bg-orange-100 text-orange-700 border border-orange-300">
- <i class="fas fa-hourglass-half mr-1"></i>slow
- </span>
- {% else %}
- <span class="inline-flex px-2 py-0.5 text-xs font-semibold rounded bg-green-100 text-green-700 border border-green-300">
- <i class="fas fa-bolt mr-1"></i>fast
- </span>
- {% endif %}
- {% for option in acl.options %}
- <span class="inline-flex px-2 py-0.5 text-xs font-mono rounded bg-blue-100 text-blue-700 border border-blue-300">
- {{ option }}
- </span>
- {% endfor %}
- </div>
-
- <p class="text-sm text-gray-600 mb-2">
- <i class="fas fa-info-circle mr-1"></i>{{ acl.type_description }}
- </p>
-
- <div class="bg-gray-50 rounded p-2 border border-gray-200">
- <div class="flex flex-wrap gap-1">
- {% for value in acl.value_list %}
- <span class="inline-flex px-2 py-1 text-xs font-mono rounded bg-white text-gray-700 border border-gray-300">
- {{ value }}
- </span>
- {% endfor %}
- </div>
- </div>
-
- {% if acl.comment %}
- <p class="text-xs text-gray-500 mt-2 italic">
- <i class="fas fa-comment-alt mr-1"></i>{{ acl.comment }}
- </p>
- {% endif %}
- </div>
- </div>
-
- <div class="flex space-x-2 flex-shrink-0 sm:ml-3">
- <button onclick='editAcl({{ acl.id }}, "{{ acl.name }}", "{{ acl.type }}", {{ acl.value_list|tojson }}, {{ acl.options|tojson }}, "{{ acl.comment }}")'
- class="text-blue-600 hover:text-blue-900 p-2 hover:bg-blue-100 rounded"
- title="{{ _("Editar") }}">
- <i class="fas fa-edit text-lg"></i>
- </button>
- <button onclick='deleteAcl({{ acl.id }}, "{{ acl.name }}")'
- class="text-red-600 hover:text-red-900 p-2 hover:bg-red-100 rounded"
- title="{{ _("Eliminar") }}">
- <i class="fas fa-trash text-lg"></i>
- </button>
- </div>
- </div>
- {% endfor %}
- </div>
- {% else %}
- <div class="text-center py-12 bg-gray-50 rounded-lg border-2 border-dashed border-gray-300">
- <i class="fas fa-shield-alt text-6xl text-gray-300 mb-4"></i>
- <p class="text-gray-500 text-lg font-medium">{{ _("No hay ACLs personalizadas configuradas") }}</p>
- <p class="text-gray-400 text-sm mt-2">{{ _("Las ACLs predefinidas de Squid siguen disponibles") }}</p>
- <button onclick="showAddModal()" class="mt-4 bg-blue-600 hover:bg-blue-700 text-white font-semibold px-6 py-2 rounded-lg shadow-md transition-colors">
- <i class="fas fa-plus mr-2"></i>{{ _("Crear primera ACL") }}
- </button>
- </div>
- {% endif %}
- </div>
- {% include 'admin/acls_modals.html' %}
- <script src="{{ url_for('static', filename='js/acls.js') }}"></script>
- {% endblock %}
|