From 765e06d0c62f8a9324559e005dd7e472fd850c00 Mon Sep 17 00:00:00 2001 From: chirac Date: Sat, 9 Jul 2016 15:47:10 +0200 Subject: [PATCH] Remplace admin par infra pour les modifications de topologie --- .../templates/machines/aff_extension.html | 2 +- .../templates/machines/aff_machinetype.html | 2 +- .../templates/machines/index_extension.html | 2 +- .../templates/machines/index_machinetype.html | 2 +- machines/views.py | 20 +++++++++---------- topologie/templates/topologie/aff_port.html | 2 +- topologie/templates/topologie/index.html | 2 +- topologie/templates/topologie/index_p.html | 2 +- topologie/views.py | 16 +++++++-------- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/machines/templates/machines/aff_extension.html b/machines/templates/machines/aff_extension.html index 5a96efb5..85f57f65 100644 --- a/machines/templates/machines/aff_extension.html +++ b/machines/templates/machines/aff_extension.html @@ -8,7 +8,7 @@ {% for extension in extension_list %} {{ extension.name }} - {% if is_admin %} Editer{% endif %} + {% if is_infra %} Editer{% endif %} {% endfor %} diff --git a/machines/templates/machines/aff_machinetype.html b/machines/templates/machines/aff_machinetype.html index 9103a970..7a7832d0 100644 --- a/machines/templates/machines/aff_machinetype.html +++ b/machines/templates/machines/aff_machinetype.html @@ -10,7 +10,7 @@ {{ type.type }} {{ type.extension }} - {% if is_admin %} Editer{% endif %} + {% if is_infra %} Editer{% endif %} {% endfor %} diff --git a/machines/templates/machines/index_extension.html b/machines/templates/machines/index_extension.html index 646fb7b8..35c13f00 100644 --- a/machines/templates/machines/index_extension.html +++ b/machines/templates/machines/index_extension.html @@ -5,7 +5,7 @@ {% block content %}

Liste des extensions

- {% if is_admin %} + {% if is_infra %} Ajouter une extension Supprimer une ou plusieurs extensions {% endif %} diff --git a/machines/templates/machines/index_machinetype.html b/machines/templates/machines/index_machinetype.html index 0b0c4554..bc38795e 100644 --- a/machines/templates/machines/index_machinetype.html +++ b/machines/templates/machines/index_machinetype.html @@ -5,7 +5,7 @@ {% block content %}

Liste des types de machines

- {% if is_admin %} + {% if is_infra %} Ajouter un type de machine Supprimer un ou plusieurs types de machines {% endif %} diff --git a/machines/views.py b/machines/views.py index 5d7c3e6c..5a849c7b 100644 --- a/machines/views.py +++ b/machines/views.py @@ -111,7 +111,7 @@ def new_interface(request, machineid): return form({'machineform': machine_form, 'interfaceform': interface_form}, 'machines/machine.html', request) @login_required -@permission_required('admin') +@permission_required('infra') def add_machinetype(request): machinetype = MachineTypeForm(request.POST or None) if machinetype.is_valid(): @@ -121,7 +121,7 @@ def add_machinetype(request): return form({'machineform': machinetype, 'interfaceform': None}, 'machines/machine.html', request) @login_required -@permission_required('admin') +@permission_required('infra') def edit_machinetype(request, machinetypeid): try: machinetype_instance = MachineType.objects.get(pk=machinetypeid) @@ -136,7 +136,7 @@ def edit_machinetype(request, machinetypeid): return form({'machineform': machinetype}, 'machines/machine.html', request) @login_required -@permission_required('admin') +@permission_required('infra') def del_machinetype(request): machinetype = DelMachineTypeForm(request.POST or None) if machinetype.is_valid(): @@ -151,7 +151,7 @@ def del_machinetype(request): return form({'machineform': machinetype, 'interfaceform': None}, 'machines/machine.html', request) @login_required -@permission_required('admin') +@permission_required('infra') def add_extension(request): extension = ExtensionForm(request.POST or None) if extension.is_valid(): @@ -161,7 +161,7 @@ def add_extension(request): return form({'machineform': extension, 'interfaceform': None}, 'machines/machine.html', request) @login_required -@permission_required('admin') +@permission_required('infra') def edit_extension(request, extensionid): try: extension_instance = Extension.objects.get(pk=extensionid) @@ -176,7 +176,7 @@ def edit_extension(request, extensionid): return form({'machineform': extension}, 'machines/machine.html', request) @login_required -@permission_required('admin') +@permission_required('infra') def del_extension(request): extension = DelExtensionForm(request.POST or None) if extension.is_valid(): @@ -197,12 +197,12 @@ def index(request): @login_required def index_machinetype(request): - is_admin = request.user.has_perms(('admin',)) + is_infra = request.user.has_perms(('infra',)) machinetype_list = MachineType.objects.order_by('type') - return render(request, 'machines/index_machinetype.html', {'machinetype_list':machinetype_list, 'is_admin':is_admin}) + return render(request, 'machines/index_machinetype.html', {'machinetype_list':machinetype_list, 'is_infra':is_infra}) @login_required def index_extension(request): - is_admin = request.user.has_perms(('admin',)) + is_infra = request.user.has_perms(('infra',)) extension_list = Extension.objects.order_by('name') - return render(request, 'machines/index_extension.html', {'extension_list':extension_list, 'is_admin':is_admin}) + return render(request, 'machines/index_extension.html', {'extension_list':extension_list, 'is_infra':is_infra}) diff --git a/topologie/templates/topologie/aff_port.html b/topologie/templates/topologie/aff_port.html index 24e53f23..4976a9fd 100644 --- a/topologie/templates/topologie/aff_port.html +++ b/topologie/templates/topologie/aff_port.html @@ -16,7 +16,7 @@ {{ port.machine_interface }} {{ port.related }} {{ port.details }} - {% if is_admin %} Editer{% endif %} + {% if is_infra %} Editer{% endif %} {% endfor %} diff --git a/topologie/templates/topologie/index.html b/topologie/templates/topologie/index.html index 03b8beda..d9d2ccb4 100644 --- a/topologie/templates/topologie/index.html +++ b/topologie/templates/topologie/index.html @@ -4,7 +4,7 @@ {% block title %}Switchs{% endblock %} {% block content %} -{% if is_admin %} +{% if is_infra %} Ajouter un switch {% endif %} {% include "topologie/aff_switch.html" with switch_list=switch_list %} diff --git a/topologie/templates/topologie/index_p.html b/topologie/templates/topologie/index_p.html index 647e8e52..cb06df8f 100644 --- a/topologie/templates/topologie/index_p.html +++ b/topologie/templates/topologie/index_p.html @@ -5,7 +5,7 @@ {% block content %}

Switch {{ nom_switch }}

-{% if is_admin %} +{% if is_infra %} Editer Ajouter un port {% endif %} diff --git a/topologie/views.py b/topologie/views.py index 54323a45..2e67cc9c 100644 --- a/topologie/views.py +++ b/topologie/views.py @@ -9,23 +9,23 @@ from users.views import form @login_required def index(request): - is_admin = request.user.has_perms(('admin',)) + is_infra = request.user.has_perms(('infra',)) switch_list = Switch.objects.order_by('building', 'number') - return render(request, 'topologie/index.html', {'switch_list': switch_list, 'is_admin':is_admin}) + return render(request, 'topologie/index.html', {'switch_list': switch_list, 'is_infra':is_infra}) @login_required def index_port(request, switch_id): - is_admin = request.user.has_perms(('admin',)) + is_infra = request.user.has_perms(('infra',)) try: switch = Switch.objects.get(pk=switch_id) except Switch.DoesNotExist: messages.error(request, u"Switch inexistant") return redirect("/topologie/") port_list = Port.objects.filter(switch = switch).order_by('port') - return render(request, 'topologie/index_p.html', {'port_list':port_list, 'id_switch':switch_id, 'nom_switch':switch, 'is_admin':is_admin}) + return render(request, 'topologie/index_p.html', {'port_list':port_list, 'id_switch':switch_id, 'nom_switch':switch, 'is_infra':is_infra}) @login_required -@permission_required('admin') +@permission_required('infra') def new_port(request, switch_id): try: switch = Switch.objects.get(pk=switch_id) @@ -45,7 +45,7 @@ def new_port(request, switch_id): return form({'topoform':port}, 'topologie/port.html', request) @login_required -@permission_required('admin') +@permission_required('infra') def edit_port(request, port_id): try: port = Port.objects.get(pk=port_id) @@ -60,7 +60,7 @@ def edit_port(request, port_id): return form({'topoform':port}, 'topologie/port.html', request) @login_required -@permission_required('admin') +@permission_required('infra') def new_switch(request): switch = EditSwitchForm(request.POST or None) if switch.is_valid(): @@ -70,7 +70,7 @@ def new_switch(request): return form({'topoform':switch}, 'topologie/port.html', request) @login_required -@permission_required('admin') +@permission_required('infra') def edit_switch(request, switch_id): try: switch = Switch.objects.get(pk=switch_id)