From f412a07e0911a45ccbc084e86dea54f9ce060bb1 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Wed, 27 Dec 2017 19:11:04 +0100 Subject: [PATCH] Passe au templatetag dans les templates machines --- .../templates/machines/aff_extension.html | 2 -- machines/templates/machines/aff_iptype.html | 2 -- .../templates/machines/aff_machinetype.html | 2 -- machines/templates/machines/aff_mx.html | 2 -- machines/templates/machines/aff_nas.html | 2 -- machines/templates/machines/aff_ns.html | 2 -- machines/templates/machines/aff_service.html | 2 -- machines/templates/machines/aff_soa.html | 2 -- machines/templates/machines/aff_srv.html | 2 -- machines/templates/machines/aff_txt.html | 2 -- machines/templates/machines/aff_vlan.html | 2 -- .../templates/machines/index_extension.html | 12 ---------- machines/templates/machines/index_iptype.html | 2 -- .../templates/machines/index_machinetype.html | 2 -- machines/templates/machines/index_nas.html | 2 -- .../templates/machines/index_service.html | 2 -- machines/templates/machines/index_vlan.html | 2 -- machines/templates/machines/sidebar.html | 23 +++++++++++++++---- 18 files changed, 18 insertions(+), 49 deletions(-) diff --git a/machines/templates/machines/aff_extension.html b/machines/templates/machines/aff_extension.html index 15a4c637..d2fca481 100644 --- a/machines/templates/machines/aff_extension.html +++ b/machines/templates/machines/aff_extension.html @@ -45,9 +45,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ extension.origin_v6 }} {% endif %} - {% if is_infra %} {% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %} - {% endif %} {% include 'buttons/history.html' with href='machines:history' name='extension' id=extension.id %} diff --git a/machines/templates/machines/aff_iptype.html b/machines/templates/machines/aff_iptype.html index 454b169d..dc50cd4c 100644 --- a/machines/templates/machines/aff_iptype.html +++ b/machines/templates/machines/aff_iptype.html @@ -48,9 +48,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ type.vlan }} {{ type.ouverture_ports }} - {% if is_infra %} {% include 'buttons/edit.html' with href='machines:edit-iptype' id=type.id %} - {% endif %} {% include 'buttons/history.html' with href='machines:history' name='iptype' id=type.id %} diff --git a/machines/templates/machines/aff_machinetype.html b/machines/templates/machines/aff_machinetype.html index 7fdcbdb4..44070dc6 100644 --- a/machines/templates/machines/aff_machinetype.html +++ b/machines/templates/machines/aff_machinetype.html @@ -35,9 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ type.type }} {{ type.ip_type }} - {% if is_infra %} {% include 'buttons/edit.html' with href='machines:edit-machinetype' id=type.id %} - {% endif %} {% include 'buttons/history.html' with href='machines:history' name='machinetype' id=type.id %} diff --git a/machines/templates/machines/aff_mx.html b/machines/templates/machines/aff_mx.html index 176ab061..8c27bbfd 100644 --- a/machines/templates/machines/aff_mx.html +++ b/machines/templates/machines/aff_mx.html @@ -38,9 +38,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ mx.priority }} {{ mx.name }} - {% if is_infra %} {% include 'buttons/edit.html' with href='machines:edit-mx' id=mx.id %} - {% endif %} {% include 'buttons/history.html' with href='machines:history' name='mx' id=mx.id %} diff --git a/machines/templates/machines/aff_nas.html b/machines/templates/machines/aff_nas.html index dc8fd079..670ef893 100644 --- a/machines/templates/machines/aff_nas.html +++ b/machines/templates/machines/aff_nas.html @@ -41,9 +41,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ nas.port_access_mode }} {{ nas.autocapture_mac }} - {% if is_infra %} {% include 'buttons/edit.html' with href='machines:edit-nas' id=nas.id %} - {% endif %} {% include 'buttons/history.html' with href='machines:history' name='nas' id=nas.id %} diff --git a/machines/templates/machines/aff_ns.html b/machines/templates/machines/aff_ns.html index 67a0dd81..d1157c52 100644 --- a/machines/templates/machines/aff_ns.html +++ b/machines/templates/machines/aff_ns.html @@ -36,9 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ ns.zone }} {{ ns.ns }} - {% if is_infra %} {% include 'buttons/edit.html' with href='machines:edit-ns' id=ns.id %} - {% endif %} {% include 'buttons/history.html' with href='machines:history' name='ns' id=ns.id %} diff --git a/machines/templates/machines/aff_service.html b/machines/templates/machines/aff_service.html index 47bfee25..e8a228da 100644 --- a/machines/templates/machines/aff_service.html +++ b/machines/templates/machines/aff_service.html @@ -40,9 +40,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ service.regular_time_regen }} {% for serv in service.servers.all %}{{ serv }}, {% endfor %} - {% if is_infra %} {% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %} - {% endif %} {% include 'buttons/history.html' with href='machines:history' name='service' id=service.id %} diff --git a/machines/templates/machines/aff_soa.html b/machines/templates/machines/aff_soa.html index 3dad11c7..3386ed2d 100644 --- a/machines/templates/machines/aff_soa.html +++ b/machines/templates/machines/aff_soa.html @@ -44,9 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ soa.expire }} {{ soa.ttl }} - {% if is_infra %} {% include 'buttons/edit.html' with href='machines:edit-soa' id=soa.id %} - {% endif %} {% include 'buttons/history.html' with href='machines:history' name='soa' id=soa.id %} diff --git a/machines/templates/machines/aff_srv.html b/machines/templates/machines/aff_srv.html index 773815d9..039df718 100644 --- a/machines/templates/machines/aff_srv.html +++ b/machines/templates/machines/aff_srv.html @@ -48,9 +48,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ srv.port }} {{ srv.target }} - {% if is_infra %} {% include 'buttons/edit.html' with href='machines:edit-srv' id=srv.id %} - {% endif %} {% include 'buttons/history.html' with href='machines:history' name='srv' id=srv.id %} diff --git a/machines/templates/machines/aff_txt.html b/machines/templates/machines/aff_txt.html index fd7c5ee6..053cb239 100644 --- a/machines/templates/machines/aff_txt.html +++ b/machines/templates/machines/aff_txt.html @@ -36,9 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ txt.zone }} {{ txt.dns_entry }} - {% if is_infra %} {% include 'buttons/edit.html' with href='machines:edit-txt' id=txt.id %} - {% endif %} {% include 'buttons/history.html' with href='machines:history' name='txt' id=txt.id %} diff --git a/machines/templates/machines/aff_vlan.html b/machines/templates/machines/aff_vlan.html index eaa1c82c..3245d877 100644 --- a/machines/templates/machines/aff_vlan.html +++ b/machines/templates/machines/aff_vlan.html @@ -39,9 +39,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ vlan.comment }} {% for range in vlan.iptype_set.all %}{{ range }}, {% endfor%} - {% if is_infra %} {% include 'buttons/edit.html' with href='machines:edit-vlan' id=vlan.id %} - {% endif %} {% include 'buttons/history.html' with href='machines:history' name='vlan' id=vlan.id %} diff --git a/machines/templates/machines/index_extension.html b/machines/templates/machines/index_extension.html index 3169b4c9..5f8d1bd2 100644 --- a/machines/templates/machines/index_extension.html +++ b/machines/templates/machines/index_extension.html @@ -29,41 +29,29 @@ with this program; if not, write to the Free Software Foundation, Inc., {% block content %}

Liste des extensions

- {% if is_infra %} Ajouter une extension Supprimer une ou plusieurs extensions - {% endif %} {% include "machines/aff_extension.html" with extension_list=extension_list %}

Liste des enregistrements SOA

- {% if is_infra %} Ajouter un enregistrement SOA Supprimer un enregistrement SOA - {% endif %} {% include "machines/aff_soa.html" with soa_list=soa_list %}

Liste des enregistrements MX

- {% if is_infra %} Ajouter un enregistrement MX Supprimer un enregistrement MX - {% endif %} {% include "machines/aff_mx.html" with mx_list=mx_list %}

Liste des enregistrements NS

- {% if is_infra %} Ajouter un enregistrement NS Supprimer un enregistrement NS - {% endif %} {% include "machines/aff_ns.html" with ns_list=ns_list %}

Liste des enregistrements TXT

- {% if is_infra %} Ajouter un enregistrement TXT Supprimer un enregistrement TXT - {% endif %} {% include "machines/aff_txt.html" with txt_list=txt_list %}

Liste des enregistrements SRV

- {% if is_infra %} Ajouter un enregistrement SRV Supprimer un enregistrement SRV - {% endif %} {% include "machines/aff_srv.html" with srv_list=srv_list %}

diff --git a/machines/templates/machines/index_iptype.html b/machines/templates/machines/index_iptype.html index 8f85130b..10bb2079 100644 --- a/machines/templates/machines/index_iptype.html +++ b/machines/templates/machines/index_iptype.html @@ -29,10 +29,8 @@ with this program; if not, write to the Free Software Foundation, Inc., {% block content %}

Liste des types d'ip

- {% if is_infra %} Ajouter un type d'ip Supprimer un ou plusieurs types d'ip - {% endif %} {% include "machines/aff_iptype.html" with iptype_list=iptype_list %}

diff --git a/machines/templates/machines/index_machinetype.html b/machines/templates/machines/index_machinetype.html index 1e99fd2d..75399aba 100644 --- a/machines/templates/machines/index_machinetype.html +++ b/machines/templates/machines/index_machinetype.html @@ -29,10 +29,8 @@ with this program; if not, write to the Free Software Foundation, Inc., {% block content %}

Liste des types de machines

- {% if is_infra %} Ajouter un type de machine Supprimer un ou plusieurs types de machines - {% endif %} {% include "machines/aff_machinetype.html" with machinetype_list=machinetype_list %}

diff --git a/machines/templates/machines/index_nas.html b/machines/templates/machines/index_nas.html index ac1fe8b4..16fb29e2 100644 --- a/machines/templates/machines/index_nas.html +++ b/machines/templates/machines/index_nas.html @@ -31,10 +31,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,

Liste des nas

La correpondance nas-machinetype relie le type de nas à un type de machine. Elle est utile pour l'autoenregistrement des macs par radius, et permet de choisir le type de machine à affecter aux machines en fonction du type de nas
- {% if is_infra %} Ajouter un type de nas Supprimer un ou plusieurs types nas - {% endif %} {% include "machines/aff_nas.html" with nas_list=nas_list %}

diff --git a/machines/templates/machines/index_service.html b/machines/templates/machines/index_service.html index b07f994c..1fa917f3 100644 --- a/machines/templates/machines/index_service.html +++ b/machines/templates/machines/index_service.html @@ -29,10 +29,8 @@ with this program; if not, write to the Free Software Foundation, Inc., {% block content %}

Liste des services

- {% if is_infra %} Ajouter un service Supprimer un ou plusieurs service - {% endif %} {% include "machines/aff_service.html" with service_list=service_list %}

Etat des serveurs

{% include "machines/aff_servers.html" with servers_list=servers_list %} diff --git a/machines/templates/machines/index_vlan.html b/machines/templates/machines/index_vlan.html index ec00b0bf..ccbfa753 100644 --- a/machines/templates/machines/index_vlan.html +++ b/machines/templates/machines/index_vlan.html @@ -29,10 +29,8 @@ with this program; if not, write to the Free Software Foundation, Inc., {% block content %}

Liste des vlans

- {% if is_infra %} Ajouter un vlan Supprimer un ou plusieurs vlan - {% endif %} {% include "machines/aff_vlan.html" with vlan_list=vlan_list %}

diff --git a/machines/templates/machines/sidebar.html b/machines/templates/machines/sidebar.html index 6ca3a07f..355d5147 100644 --- a/machines/templates/machines/sidebar.html +++ b/machines/templates/machines/sidebar.html @@ -23,42 +23,55 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. {% endcomment %} +{% load acl %} {% block sidebar %} - {% if is_cableur %} + {% can_view_all Machine %} Machines + {% acl_end %} + {% can_view_all MachineType %} Types de machines + {% acl_end %} + {% can_view_all Extension %} Extensions et zones + {% acl_end %} + {% can_view_all IpType %} Plages d'IP + {% acl_end %} + {% can_view_all Vlan %} Vlans + {% acl_end %} + {% can_view_all Nas %} Gestion des nas + {% acl_end %} + {% can_view_all Service %} Services (dhcp, dns...) - - {% endif %} - {% if is_cableur %} + + {% acl_end %} + {% can_view_all OuverturePortList %} Ouverture de ports - {%endif%} + {% acl_end %} {% endblock %}