8
0
Fork 0
mirror of https://gitlab.federez.net/re2o/re2o synced 2024-06-01 07:22:25 +00:00

fix #65, gestion propre de l'historique.

This commit is contained in:
Hugo LEVY-FALK 2018-07-19 12:30:15 +02:00
parent cfa6fe097d
commit 6b945bf322
51 changed files with 1218 additions and 1279 deletions

View file

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %} {% load acl %}
{% load i18n %} {% load i18n %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -46,14 +47,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ article.type_user }}</td> <td>{{ article.type_user }}</td>
<td>{{ article.available_for_everyone }}</td> <td>{{ article.available_for_everyone }}</td>
<td class="text-right"> <td class="text-right">
{% can_edit article %} {% can_edit article %}
<a class="btn btn-primary btn-sm" role="button" title="{% trans "Edit" %}" href="{% url 'cotisations:edit-article' article.id %}"> <a class="btn btn-primary btn-sm" role="button" title="{% trans "Edit" %}" href="{% url 'cotisations:edit-article' article.id %}">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</a> </a>
{% acl_end %} {% acl_end %}
<a class="btn btn-info btn-sm" role="button" title="{% trans "Historique" %}" href="{% url 'cotisations:history' 'article' article.id %}"> {% history_button article %}
<i class="fa fa-history"></i>
</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %} {% load acl %}
{% load i18n %} {% load i18n %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -36,14 +37,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr> <tr>
<td>{{ banque.name }}</td> <td>{{ banque.name }}</td>
<td class="text-right"> <td class="text-right">
{% can_edit banque %} {% can_edit banque %}
<a class="btn btn-primary btn-sm" role="button" title="{% trans "Edit" %}" href="{% url 'cotisations:edit-banque' banque.id %}"> <a class="btn btn-primary btn-sm" role="button" title="{% trans "Edit" %}" href="{% url 'cotisations:edit-banque' banque.id %}">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</a> </a>
{% acl_end %} {% acl_end %}
<a class="btn btn-info btn-sm" role="button" title="{% trans "Historique" %}" href="{% url 'cotisations:history' 'banque' banque.id %}"> {% history_button banque %}
<i class="fa fa-history"></i>
</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %} {% load acl %}
{% load i18n %} {% load i18n %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
{% if facture_list.paginator %} {% if facture_list.paginator %}
@ -86,9 +87,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</li> </li>
{% acl_end %} {% acl_end %}
<li> <li>
<a href="{% url 'cotisations:history' 'facture' facture.id %}"> {% history_button facture text='History' html_class=''%}
<i class="fa fa-history"></i> {% trans "Historique" %}
</a>
</li> </li>
</ul> </ul>
</div> </div>

View file

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %} {% load acl %}
{% load i18n %} {% load i18n %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -47,9 +48,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</a> </a>
{% acl_end %} {% acl_end %}
<a class="btn btn-info btn-sm" role="button" title="{% trans "Historique" %}" href="{% url 'cotisations:history' 'paiement' paiement.id %}"> {% history_button paiement %}
<i class="fa fa-history"></i>
</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -27,7 +27,6 @@ from __future__ import unicode_literals
from django.conf.urls import url from django.conf.urls import url
import re2o
from . import views from . import views
from . import payment_methods from . import payment_methods
@ -122,12 +121,6 @@ urlpatterns = [
views.index_paiement, views.index_paiement,
name='index-paiement' name='index-paiement'
), ),
url(
r'history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
re2o.views.history,
name='history',
kwargs={'application': 'cotisations'},
),
url( url(
r'^control/$', r'^control/$',
views.control, views.control,

View file

@ -33,3 +33,15 @@ register = template.Library()
def classname(obj): def classname(obj):
""" Returns the object class name """ """ Returns the object class name """
return obj.__class__.__name__ return obj.__class__.__name__
@register.inclusion_tag('buttons/history.html')
def history_button(instance, text=None, html_class=None):
"""Creates the correct history button for an instance."""
return {
'application': instance._meta.app_label,
'name': instance._meta.model_name,
'id': instance.id,
'text': text,
'class': html_class,
}

View file

@ -39,4 +39,9 @@ urlpatterns = [
url(r'^stats_models/$', views.stats_models, name='stats-models'), url(r'^stats_models/$', views.stats_models, name='stats-models'),
url(r'^stats_users/$', views.stats_users, name='stats-users'), url(r'^stats_users/$', views.stats_users, name='stats-users'),
url(r'^stats_actions/$', views.stats_actions, name='stats-actions'), url(r'^stats_actions/$', views.stats_actions, name='stats-actions'),
url(
r'(?P<application>\w+)/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
views.history,
name='history',
),
] ]

View file

@ -2,9 +2,10 @@
# se veut agnostique au réseau considéré, de manière à être installable en # se veut agnostique au réseau considéré, de manière à être installable en
# quelques clics. # quelques clics.
# #
# Copyright © 2017 Gabriel Détraz # Copyright © 2018 Gabriel Détraz
# Copyright © 2017 Goulven Kermarec # Copyright © 2018 Goulven Kermarec
# Copyright © 2017 Augustin Lemesle # Copyright © 2018 Augustin Lemesle
# Copyright © 2018 Hugo Levy-Falk
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -36,12 +37,15 @@ nombre d'objets par models, nombre d'actions par user, etc
""" """
from __future__ import unicode_literals from __future__ import unicode_literals
from itertools import chain
from django.urls import reverse from django.urls import reverse
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.http import Http404
from django.db.models import Count, Max, F from django.db.models import Count, Max, F
from django.apps import apps
from reversion.models import Revision from reversion.models import Revision
from reversion.models import Version, ContentType from reversion.models import Version, ContentType
@ -453,3 +457,61 @@ def stats_actions(request):
}, },
} }
return render(request, 'logs/stats_users.html', {'stats_list': stats}) return render(request, 'logs/stats_users.html', {'stats_list': stats})
def history(request, application, object_name, object_id):
"""Render history for a model.
The model is determined using the `HISTORY_BIND` dictionnary if none is
found, raises a Http404. The view checks if the user is allowed to see the
history using the `can_view` method of the model.
Args:
request: The request sent by the user.
application: Name of the application.
object_name: Name of the model.
object_id: Id of the object you want to acces history.
Returns:
The rendered page of history if access is granted, else the user is
redirected to their profile page, with an error message.
Raises:
Http404: This kind of models doesn't have history.
"""
try:
model = apps.get_model(application, object_name)
except LookupError:
raise Http404(u"Il n'existe pas d'historique pour ce modèle.")
object_name_id = object_name + 'id'
kwargs = {object_name_id: object_id}
try:
instance = model.get_instance(**kwargs)
except model.DoesNotExist:
messages.error(request, u"Entrée inexistante")
return redirect(reverse(
'users:profil',
kwargs={'userid': str(request.user.id)}
))
can, msg = instance.can_view(request.user)
if not can:
messages.error(request, msg or "Vous ne pouvez pas accéder à ce menu")
return redirect(reverse(
'users:profil',
kwargs={'userid': str(request.user.id)}
))
pagination_number = GeneralOption.get_cached_value('pagination_number')
reversions = Version.objects.get_for_object(instance)
if hasattr(instance, 'linked_objects'):
for related_object in chain(instance.linked_objects()):
reversions = (reversions |
Version.objects.get_for_object(related_object))
reversions = re2o_paginator(request, reversions, pagination_number)
return render(
request,
're2o/history.html',
{'reversions': reversions, 'object': instance}
)

View file

@ -23,24 +23,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>Alias</th>
<th></th>
</tr>
</thead>
{% for alias in alias_list %}
<tr> <tr>
<td>{{ alias }}</td> <th>Alias</th>
<td class="text-right"> <th></th>
{% can_edit alias %}
{% include 'buttons/edit.html' with href='machines:edit-alias' id=alias.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='domain' id=alias.id %}
</td>
</tr> </tr>
{% endfor %} </thead>
</table> {% for alias in alias_list %}
<tr>
<td>{{ alias }}</td>
<td class="text-right">
{% can_edit alias %}
{% include 'buttons/edit.html' with href='machines:edit-alias' id=alias.id %}
{% acl_end %}
{% history_button alias %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
@ -30,28 +31,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr> <tr>
<th>Extension</th> <th>Extension</th>
<th>Droit infra pour utiliser ?</th> <th>Droit infra pour utiliser ?</th>
<th>Enregistrement SOA</th> <th>Enregistrement SOA</th>
<th>Enregistrement A origin</th> <th>Enregistrement A origin</th>
{% if ipv6_enabled %} {% if ipv6_enabled %}
<th>Enregistrement AAAA origin</th> <th>Enregistrement AAAA origin</th>
{% endif %} {% endif %}
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
{% for extension in extension_list %} {% for extension in extension_list %}
<tr> <tr>
<td>{{ extension.name }}</td> <td>{{ extension.name }}</td>
<td>{{ extension.need_infra }}</td> <td>{{ extension.need_infra }}</td>
<td>{{ extension.soa}}</td> <td>{{ extension.soa}}</td>
<td>{{ extension.origin }}</td> <td>{{ extension.origin }}</td>
{% if ipv6_enabled %} {% if ipv6_enabled %}
<td>{{ extension.origin_v6 }}</td> <td>{{ extension.origin_v6 }}</td>
{% endif %} {% endif %}
<td class="text-right"> <td class="text-right">
{% can_edit extension %} {% can_edit extension %}
{% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %} {% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='extension' id=extension.id %} {% history_button extension %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -31,10 +32,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>Extension</th> <th>Extension</th>
<th>Nécessite l'autorisation infra</th> <th>Nécessite l'autorisation infra</th>
<th>Plage ipv4</th> <th>Plage ipv4</th>
<th>Préfixe v6</th> <th>Préfixe v6</th>
<th>Sur vlan</th> <th>Sur vlan</th>
<th>Ouverture ports par défault</th> <th>Ouverture ports par défault</th>
<th></th> <th></th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
@ -43,15 +44,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ type.type }}</td> <td>{{ type.type }}</td>
<td>{{ type.extension }}</td> <td>{{ type.extension }}</td>
<td>{{ type.need_infra }}</td> <td>{{ type.need_infra }}</td>
<td>{{ type.domaine_ip_start }}-{{ type.domaine_ip_stop }}</td> <td>{{ type.domaine_ip_start }}-{{ type.domaine_ip_stop }}</td>
<td>{{ type.prefix_v6 }}</td> <td>{{ type.prefix_v6 }}</td>
<td>{{ type.vlan }}</td> <td>{{ type.vlan }}</td>
<td>{{ type.ouverture_ports }}</td> <td>{{ type.ouverture_ports }}</td>
<td class="text-right"> <td class="text-right">
{% can_edit type %} {% can_edit type %}
{% include 'buttons/edit.html' with href='machines:edit-iptype' id=type.id %} {% include 'buttons/edit.html' with href='machines:edit-iptype' id=type.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='iptype' id=type.id %} {% history_button type %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -23,29 +23,30 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>Ipv6</th>
<th>Slaac</th>
<th></th>
</tr>
</thead>
{% for ipv6 in ipv6_list %}
<tr> <tr>
<td>{{ ipv6.ipv6 }}</td> <th>Ipv6</th>
<td>{{ ipv6.slaac_ip }}</td> <th>Slaac</th>
<td class="text-right"> <th></th>
{% can_edit ipv6 %}
{% include 'buttons/edit.html' with href='machines:edit-ipv6list' id=ipv6.id %}
{% acl_end %}
{% can_delete ipv6 %}
{% include 'buttons/suppr.html' with href='machines:del-ipv6list' id=ipv6.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='ipv6list' id=ipv6.id %}
</td>
</tr> </tr>
{% endfor %} </thead>
</table> {% for ipv6 in ipv6_list %}
<tr>
<td>{{ ipv6.ipv6 }}</td>
<td>{{ ipv6.slaac_ip }}</td>
<td class="text-right">
{% can_edit ipv6 %}
{% include 'buttons/edit.html' with href='machines:edit-ipv6list' id=ipv6.id %}
{% acl_end %}
{% can_delete ipv6 %}
{% include 'buttons/suppr.html' with href='machines:del-ipv6list' id=ipv6.id %}
{% acl_end %}
{% history_button ipv6 %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -22,165 +22,166 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
{% if machines_list.paginator %} {% if machines_list.paginator %}
{% include "pagination.html" with list=machines_list %} {% include "pagination.html" with list=machines_list %}
{% endif %} {% endif %}
<table class="table" id="machines_table"> <table class="table" id="machines_table">
<colgroup> <colgroup>
<col> <col>
<col> <col>
<col> <col>
<col width="{% if ipv6_enabled %}300{% else %}150{% endif %}px"> <col width="{% if ipv6_enabled %}300{% else %}150{% endif %}px">
<col width="144px"> <col width="144px">
</colgroup> </colgroup>
<thead> <thead>
<th>{% include "buttons/sort.html" with prefix='machine' col='name' text='Nom DNS' %}</th> <th>{% include "buttons/sort.html" with prefix='machine' col='name' text='Nom DNS' %}</th>
<th>Type</th> <th>Type</th>
<th>MAC</th> <th>MAC</th>
<th>IP</th> <th>IP</th>
<th>Actions</th> <th>Actions</th>
<tbody> <tbody>
{% for machine in machines_list %} {% for machine in machines_list %}
<tr class="info"> <tr class="info">
<td colspan="4"> <td colspan="4">
<b>{{ machine.name|default:'<i>Pas de nom</i>' }}</b> <i class="fa-angle-right"></i> <b>{{ machine.name|default:'<i>Pas de nom</i>' }}</b> <i class="fa-angle-right"></i>
<a href="{% url 'users:profil' userid=machine.user.id %}" title="Voir le profil"> <a href="{% url 'users:profil' userid=machine.user.id %}" title="Voir le profil">
<i class="fa fa-user"></i> {{ machine.user }} <i class="fa fa-user"></i> {{ machine.user }}
</a> </a>
</td> </td>
<td class="text-right"> <td class="text-right">
{% can_create Interface machine.id %} {% can_create Interface machine.id %}
{% include 'buttons/add.html' with href='machines:new-interface' id=machine.id desc='Ajouter une interface' %} {% include 'buttons/add.html' with href='machines:new-interface' id=machine.id desc='Ajouter une interface' %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='machine' id=machine.id %} {% history_button machine %}
{% can_delete machine %} {% can_delete machine %}
{% include 'buttons/suppr.html' with href='machines:del-machine' id=machine.id %} {% include 'buttons/suppr.html' with href='machines:del-machine' id=machine.id %}
{% acl_end %} {% acl_end %}
</td> </td>
</tr> </tr>
{% for interface in machine.interface_set.all %} {% for interface in machine.interface_set.all %}
<tr> <tr>
<td> <td>
{% if interface.domain.related_domain.all %} {% if interface.domain.related_domain.all %}
{{ interface.domain }} {{ interface.domain }}
<button class="btn btn-default btn-xs" type="button" data-toggle="collapse" data-target="#collapseDomain_{{interface.id}}" aria-expanded="true" aria-controls="collapseDomain_{{interface.id}}"> <button class="btn btn-default btn-xs" type="button" data-toggle="collapse" data-target="#collapseDomain_{{interface.id}}" aria-expanded="true" aria-controls="collapseDomain_{{interface.id}}">
Afficher les alias Afficher les alias
</button>
{% else %}
{{ interface.domain }}
{% endif %}
</td>
<td>
{{ interface.type }}
</td>
<td>
{{ interface.mac_address }}
</td>
<td>
<b>IPv4</b> {{ interface.ipv4 }}
<br>
{% if ipv6_enabled and interface.ipv6 != 'None'%}
<b>IPv6</b>
<button class="btn btn-default btn-xs" type="button" data-toggle="collapse" data-target="#collapseIpv6_{{interface.id}}" aria-expanded="true" aria-controls="collapseIpv6_{{interface.id}}">
Afficher l'IPV6
</button>
{% endif %}
</td>
<td class="text-right">
<div style="width: 128px;">
<div class="btn-group" role="group">
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" id="editioninterface" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fa fa-edit"></i> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu pull-right" aria-labelledby="editioninterface"> {% else %}
{% can_edit interface %} {{ interface.domain }}
<li> {% endif %}
<a href="{% url 'machines:edit-interface' interface.id %}"> </td>
<i class="fa fa-edit"></i> Editer <td>
</a> {{ interface.type }}
</li> </td>
<td>
{{ interface.mac_address }}
</td>
<td>
<b>IPv4</b> {{ interface.ipv4 }}
<br>
{% if ipv6_enabled and interface.ipv6 != 'None'%}
<b>IPv6</b>
<button class="btn btn-default btn-xs" type="button" data-toggle="collapse" data-target="#collapseIpv6_{{interface.id}}" aria-expanded="true" aria-controls="collapseIpv6_{{interface.id}}">
Afficher l'IPV6
</button>
{% endif %}
</td>
<td class="text-right">
<div style="width: 128px;">
<div class="btn-group" role="group">
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" id="editioninterface" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fa fa-edit"></i> <span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" aria-labelledby="editioninterface">
{% can_edit interface %}
<li>
<a href="{% url 'machines:edit-interface' interface.id %}">
<i class="fa fa-edit"></i> Editer
</a>
</li>
{% acl_end %}
{% can_create Domain interface.id %}
<li>
<a href="{% url 'machines:index-alias' interface.id %}">
<i class="fa fa-edit"></i> Gerer les alias
</a>
</li>
{% acl_end %}
{% can_create Ipv6List interface.id %}
<li>
<a href="{% url 'machines:index-ipv6' interface.id %}">
<i class="fa fa-edit"></i> Gerer les ipv6
</a>
</li>
{% acl_end %}
{% can_create OuverturePortList %}
<li>
<a href="{% url 'machines:port-config' interface.id%}">
<i class="fa fa-edit"></i> Gerer la configuration des ports
</a>
</li>
{% acl_end %}
</ul>
</div>
{% history_button interface %}
{% can_delete interface %}
{% include 'buttons/suppr.html' with href='machines:del-interface' id=interface.id %}
{% acl_end %} {% acl_end %}
{% can_create Domain interface.id %} </div>
<li> </td>
<a href="{% url 'machines:index-alias' interface.id %}"> </tr>
<i class="fa fa-edit"></i> Gerer les alias
</a>
</li>
{% acl_end %}
{% can_create Ipv6List interface.id %}
<li>
<a href="{% url 'machines:index-ipv6' interface.id %}">
<i class="fa fa-edit"></i> Gerer les ipv6
</a>
</li>
{% acl_end %}
{% can_create OuverturePortList %}
<li>
<a href="{% url 'machines:port-config' interface.id%}">
<i class="fa fa-edit"></i> Gerer la configuration des ports
</a>
</li>
{% acl_end %}
</ul>
</div>
{% include 'buttons/history.html' with href='machines:history' name='interface' id=interface.id %}
{% can_delete interface %}
{% include 'buttons/suppr.html' with href='machines:del-interface' id=interface.id %}
{% acl_end %}
</div>
</td>
</tr>
{% if ipv6_enabled and interface.ipv6 != 'None'%} {% if ipv6_enabled and interface.ipv6 != 'None'%}
<tr> <tr>
<td colspan=5 style="border-top: none; padding: 1px;"> <td colspan=5 style="border-top: none; padding: 1px;">
<div class="collapse in" id="collapseIpv6_{{interface.id}}"> <div class="collapse in" id="collapseIpv6_{{interface.id}}">
<ul class="list-group" style="margin-bottom: 0px;"> <ul class="list-group" style="margin-bottom: 0px;">
{% for ipv6 in interface.ipv6.all %} {% for ipv6 in interface.ipv6.all %}
<li class="list-group-item col-xs-6 col-sm-6 col-md-6" style="border: none;"> <li class="list-group-item col-xs-6 col-sm-6 col-md-6" style="border: none;">
{{ipv6}} {{ipv6}}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
</td> </td>
<tr> <tr>
{% endif %} {% endif %}
{% if interface.domain.related_domain.all %} {% if interface.domain.related_domain.all %}
<tr> <tr>
<td colspan=5 style="border-top: none; padding: 1px;"> <td colspan=5 style="border-top: none; padding: 1px;">
<div class="collapse in" id="collapseDomain_{{interface.id}}"> <div class="collapse in" id="collapseDomain_{{interface.id}}">
<ul class="list-group" style="margin-bottom: 0px;"> <ul class="list-group" style="margin-bottom: 0px;">
{% for al in interface.domain.related_domain.all %} {% for al in interface.domain.related_domain.all %}
<li class="list-group-item col-xs-6 col-sm-4 col-md-3" style="border: none;"> <li class="list-group-item col-xs-6 col-sm-4 col-md-3" style="border: none;">
<a href="http://{{ al }}"> <a href="http://{{ al }}">
{{ al }} {{ al }}
<i class="fa fa-share"></i> <i class="fa fa-share"></i>
</a> </a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
</td> </td>
<tr> <tr>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<tr> <tr>
<td colspan="8"></td> <td colspan="8"></td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<script> <script>
$("#machines_table").ready( function() { $("#machines_table").ready( function() {
var alias_div = [{% for machine in machines_list %}{% for interface in machine.interface_set.all %}{% if interface.domain.related_domain.all %}$("#collapseDomain_{{interface.id}}"), {% endif %}{% endfor %}{% endfor %}]; var alias_div = [{% for machine in machines_list %}{% for interface in machine.interface_set.all %}{% if interface.domain.related_domain.all %}$("#collapseDomain_{{interface.id}}"), {% endif %}{% endfor %}{% endfor %}];
for (var i=0 ; i<alias_div.length ; i++) { for (var i=0 ; i<alias_div.length ; i++) {
@ -193,9 +194,9 @@ $("#machines_table").ready( function() {
ipv6_div[i].collapse('hide'); ipv6_div[i].collapse('hide');
} }
} ); } );
</script> </script>
{% if machines_list.paginator %} {% if machines_list.paginator %}
{% include "pagination.html" with list=machines_list %} {% include "pagination.html" with list=machines_list %}
{% endif %} {% endif %}
</div> </div>

View file

@ -23,26 +23,27 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>Type de machine</th>
<th>Type d'ip correspondant</th>
<th></th>
</tr>
</thead>
{% for type in machinetype_list %}
<tr> <tr>
<td>{{ type.type }}</td> <th>Type de machine</th>
<td>{{ type.ip_type }}</td> <th>Type d'ip correspondant</th>
<td class="text-right"> <th></th>
{% can_edit type %}
{% include 'buttons/edit.html' with href='machines:edit-machinetype' id=type.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='machinetype' id=type.id %}
</td>
</tr> </tr>
{% endfor %} </thead>
</table> {% for type in machinetype_list %}
<tr>
<td>{{ type.type }}</td>
<td>{{ type.ip_type }}</td>
<td class="text-right">
{% can_edit type %}
{% include 'buttons/edit.html' with href='machines:edit-machinetype' id=type.id %}
{% acl_end %}
{% history_button type %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -23,30 +23,31 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>Zone concernée</th>
<th>Priorité</th>
<th>Enregistrement</th>
<th></th>
<th></th>
</tr>
</thead>
{% for mx in mx_list %}
<tr> <tr>
<td>{{ mx.zone }}</td> <th>Zone concernée</th>
<td>{{ mx.priority }}</td> <th>Priorité</th>
<td>{{ mx.name }}</td> <th>Enregistrement</th>
<td class="text-right"> <th></th>
<th></th>
</tr>
</thead>
{% for mx in mx_list %}
<tr>
<td>{{ mx.zone }}</td>
<td>{{ mx.priority }}</td>
<td>{{ mx.name }}</td>
<td class="text-right">
{% can_edit mx %} {% can_edit mx %}
{% include 'buttons/edit.html' with href='machines:edit-mx' id=mx.id %} {% include 'buttons/edit.html' with href='machines:edit-mx' id=mx.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='mx' id=mx.id %} {% history_button mx %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -23,32 +23,33 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>Nom</th>
<th>Type du nas</th>
<th>Type de machine reliées au nas</th>
<th>Mode d'accès</th>
<th>Autocapture mac</th>
<th></th>
</tr>
</thead>
{% for nas in nas_list %}
<tr> <tr>
<td>{{ nas.name }}</td> <th>Nom</th>
<td>{{ nas.nas_type }}</td> <th>Type du nas</th>
<td>{{ nas.machine_type }}</td> <th>Type de machine reliées au nas</th>
<td>{{ nas.port_access_mode }}</td> <th>Mode d'accès</th>
<td>{{ nas.autocapture_mac }}</td> <th>Autocapture mac</th>
<td class="text-right"> <th></th>
{% can_edit nas %}
{% include 'buttons/edit.html' with href='machines:edit-nas' id=nas.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='nas' id=nas.id %}
</td>
</tr> </tr>
{% endfor %} </thead>
</table> {% for nas in nas_list %}
<tr>
<td>{{ nas.name }}</td>
<td>{{ nas.nas_type }}</td>
<td>{{ nas.machine_type }}</td>
<td>{{ nas.port_access_mode }}</td>
<td>{{ nas.autocapture_mac }}</td>
<td class="text-right">
{% can_edit nas %}
{% include 'buttons/edit.html' with href='machines:edit-nas' id=nas.id %}
{% acl_end %}
{% history_button nas %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -23,28 +23,29 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>Zone concernée</th>
<th>Interface autoritaire de la zone</th>
<th></th>
<th></th>
</tr>
</thead>
{% for ns in ns_list %}
<tr> <tr>
<td>{{ ns.zone }}</td> <th>Zone concernée</th>
<td>{{ ns.ns }}</td> <th>Interface autoritaire de la zone</th>
<td class="text-right"> <th></th>
<th></th>
</tr>
</thead>
{% for ns in ns_list %}
<tr>
<td>{{ ns.zone }}</td>
<td>{{ ns.ns }}</td>
<td class="text-right">
{% can_edit ns %} {% can_edit ns %}
{% include 'buttons/edit.html' with href='machines:edit-ns' id=ns.id %} {% include 'buttons/edit.html' with href='machines:edit-ns' id=ns.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='ns' id=ns.id %} {% history_button ns %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -22,26 +22,26 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>Nom du service</th>
<th>Serveur</th>
<th>Dernière régénération</th>
<th>Régénération nécessaire</th>
<th>Régénération activée</th>
</tr>
</thead>
{% for server in servers_list %}
<tr> <tr>
<td>{{ server.service }}</td> <th>Nom du service</th>
<td>{{ server.server }}</td> <th>Serveur</th>
<td>{{ server.last_regen }}</td> <th>Dernière régénération</th>
<td>{{ server.asked_regen }}</td> <th>Régénération nécessaire</th>
<td>{{ server.need_regen }}</td> <th>Régénération activée</th>
<td class="text-right">
</td>
</tr> </tr>
{% endfor %} </thead>
</table> {% for server in servers_list %}
<tr>
<td>{{ server.service }}</td>
<td>{{ server.server }}</td>
<td>{{ server.last_regen }}</td>
<td>{{ server.asked_regen }}</td>
<td>{{ server.need_regen }}</td>
<td class="text-right">
</td>
</tr>
{% endfor %}
</table>

View file

@ -23,31 +23,32 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>Nom du service</th>
<th>Temps minimum avant nouvelle régénération</th>
<th>Temps avant nouvelle génération obligatoire (max)</th>
<th>Serveurs inclus</th>
<th></th>
<th></th>
</tr>
</thead>
{% for service in service_list %}
<tr> <tr>
<td>{{ service.service_type }}</td> <th>Nom du service</th>
<td>{{ service.min_time_regen }}</td> <th>Temps minimum avant nouvelle régénération</th>
<td>{{ service.regular_time_regen }}</td> <th>Temps avant nouvelle génération obligatoire (max)</th>
<td>{% for serv in service.servers.all %}{{ serv }}, {% endfor %}</td> <th>Serveurs inclus</th>
<td class="text-right"> <th></th>
{% can_edit service %} <th></th>
{% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='service' id=service.id %}
</td>
</tr> </tr>
{% endfor %} </thead>
</table> {% for service in service_list %}
<tr>
<td>{{ service.service_type }}</td>
<td>{{ service.min_time_regen }}</td>
<td>{{ service.regular_time_regen }}</td>
<td>{% for serv in service.servers.all %}{{ serv }}, {% endfor %}</td>
<td class="text-right">
{% can_edit service %}
{% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %}
{% acl_end %}
{% history_button service %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -23,36 +23,37 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>Nom</th>
<th>Mail</th>
<th>Refresh</th>
<th>Retry</th>
<th>Expire</th>
<th>TTL</th>
<th></th>
<th></th>
</tr>
</thead>
{% for soa in soa_list %}
<tr> <tr>
<td>{{ soa.name }}</td> <th>Nom</th>
<td>{{ soa.mail }}</td> <th>Mail</th>
<td>{{ soa.refresh }}</td> <th>Refresh</th>
<td>{{ soa.retry }}</td> <th>Retry</th>
<td>{{ soa.expire }}</td> <th>Expire</th>
<td>{{ soa.ttl }}</td> <th>TTL</th>
<td class="text-right"> <th></th>
<th></th>
</tr>
</thead>
{% for soa in soa_list %}
<tr>
<td>{{ soa.name }}</td>
<td>{{ soa.mail }}</td>
<td>{{ soa.refresh }}</td>
<td>{{ soa.retry }}</td>
<td>{{ soa.expire }}</td>
<td>{{ soa.ttl }}</td>
<td class="text-right">
{% can_edit soa %} {% can_edit soa %}
{% include 'buttons/edit.html' with href='machines:edit-soa' id=soa.id %} {% include 'buttons/edit.html' with href='machines:edit-soa' id=soa.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='soa' id=soa.id %} {% history_button soa %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -23,40 +23,41 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>Service</th>
<th>Protocole</th>
<th>Extension</th>
<th>TTL</th>
<th>Priorité</th>
<th>Poids</th>
<th>Port</th>
<th>Cible</th>
<th></th>
<th></th>
</tr>
</thead>
{% for srv in srv_list %}
<tr> <tr>
<td>{{ srv.service }}</td> <th>Service</th>
<td>{{ srv.protocole }}</td> <th>Protocole</th>
<td>{{ srv.extension }}</td> <th>Extension</th>
<td>{{ srv.ttl }}</td> <th>TTL</th>
<td>{{ srv.priority }}</td> <th>Priorité</th>
<td>{{ srv.weight }}</td> <th>Poids</th>
<td>{{ srv.port }}</td> <th>Port</th>
<td>{{ srv.target }}</td> <th>Cible</th>
<td class="text-right"> <th></th>
{% can_edit srv %} <th></th>
{% include 'buttons/edit.html' with href='machines:edit-srv' id=srv.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='srv' id=srv.id %}
</td>
</tr> </tr>
{% endfor %} </thead>
</table> {% for srv in srv_list %}
<tr>
<td>{{ srv.service }}</td>
<td>{{ srv.protocole }}</td>
<td>{{ srv.extension }}</td>
<td>{{ srv.ttl }}</td>
<td>{{ srv.priority }}</td>
<td>{{ srv.weight }}</td>
<td>{{ srv.port }}</td>
<td>{{ srv.target }}</td>
<td class="text-right">
{% can_edit srv %}
{% include 'buttons/edit.html' with href='machines:edit-srv' id=srv.id %}
{% acl_end %}
{% history_button srv %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -23,28 +23,29 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>Zone concernée</th>
<th>Enregistrement</th>
<th></th>
<th></th>
</tr>
</thead>
{% for txt in txt_list %}
<tr> <tr>
<td>{{ txt.zone }}</td> <th>Zone concernée</th>
<td>{{ txt.dns_entry }}</td> <th>Enregistrement</th>
<td class="text-right"> <th></th>
<th></th>
</tr>
</thead>
{% for txt in txt_list %}
<tr>
<td>{{ txt.zone }}</td>
<td>{{ txt.dns_entry }}</td>
<td class="text-right">
{% can_edit txt %} {% can_edit txt %}
{% include 'buttons/edit.html' with href='machines:edit-txt' id=txt.id %} {% include 'buttons/edit.html' with href='machines:edit-txt' id=txt.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='txt' id=txt.id %} {% history_button txt %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
@ -30,22 +31,22 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr> <tr>
<th>Id</th> <th>Id</th>
<th>Nom</th> <th>Nom</th>
<th>Commentaire</th> <th>Commentaire</th>
<th>Ranges ip</th> <th>Ranges ip</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
{% for vlan in vlan_list %} {% for vlan in vlan_list %}
<tr> <tr>
<td>{{ vlan.vlan_id }}</td> <td>{{ vlan.vlan_id }}</td>
<td>{{ vlan.name }}</td> <td>{{ vlan.name }}</td>
<td>{{ vlan.comment }}</td> <td>{{ vlan.comment }}</td>
<td>{% for range in vlan.iptype_set.all %}{{ range }}, {% endfor%}</td> <td>{% for range in vlan.iptype_set.all %}{{ range }}, {% endfor%}</td>
<td class="text-right"> <td class="text-right">
{% can_edit vlan %} {% can_edit vlan %}
{% include 'buttons/edit.html' with href='machines:edit-vlan' id=vlan.id %} {% include 'buttons/edit.html' with href='machines:edit-vlan' id=vlan.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='vlan' id=vlan.id %} {% history_button vlan %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -27,7 +27,6 @@ The defined URLs for the Cotisations app
from __future__ import unicode_literals from __future__ import unicode_literals
from django.conf.urls import url from django.conf.urls import url
import re2o
from . import views from . import views
urlpatterns = [ urlpatterns = [
@ -119,10 +118,6 @@ urlpatterns = [
url(r'^edit_nas/(?P<nasid>[0-9]+)$', views.edit_nas, name='edit-nas'), url(r'^edit_nas/(?P<nasid>[0-9]+)$', views.edit_nas, name='edit-nas'),
url(r'^del_nas/$', views.del_nas, name='del-nas'), url(r'^del_nas/$', views.del_nas, name='del-nas'),
url(r'^index_nas/$', views.index_nas, name='index-nas'), url(r'^index_nas/$', views.index_nas, name='index-nas'),
url(r'history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
re2o.views.history,
name='history',
kwargs={'application': 'machines'}),
url(r'^$', views.index, name='index'), url(r'^$', views.index, name='index'),
url(r'^rest/mac-ip/$', views.mac_ip, name='mac-ip'), url(r'^rest/mac-ip/$', views.mac_ip, name='mac-ip'),
url(r'^rest/regen-achieved/$', url(r'^rest/regen-achieved/$',

View file

@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
@ -43,7 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit service%} {% can_edit service%}
{% include 'buttons/edit.html' with href='preferences:edit-service' id=service.id %} {% include 'buttons/edit.html' with href='preferences:edit-service' id=service.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='preferences:history' name='service' id=service.id %} {% history_button service %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -27,7 +27,6 @@ from __future__ import unicode_literals
from django.conf.urls import url from django.conf.urls import url
import re2o
from . import views from . import views
@ -74,11 +73,5 @@ urlpatterns = [
name='edit-service' name='edit-service'
), ),
url(r'^del_services/$', views.del_services, name='del-services'), url(r'^del_services/$', views.del_services, name='del-services'),
url(
r'^history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
re2o.views.history,
name='history',
kwargs={'application': 'preferences'},
),
url(r'^$', views.display_options, name='display-options'), url(r'^$', views.display_options, name='display-options'),
] ]

View file

@ -26,33 +26,20 @@ les views
from __future__ import unicode_literals from __future__ import unicode_literals
from itertools import chain
import git import git
from reversion.models import Version
from django.http import Http404 from django.shortcuts import render
from django.urls import reverse
from django.shortcuts import render, redirect
from django.template.context_processors import csrf from django.template.context_processors import csrf
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.conf import settings from django.conf import settings
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.views.decorators.cache import cache_page from django.views.decorators.cache import cache_page
import preferences
from preferences.models import ( from preferences.models import (
Service, Service,
GeneralOption,
AssoOption, AssoOption,
HomeOption HomeOption
) )
import users
import cotisations
import topologie
import machines
from .utils import re2o_paginator
from .contributors import CONTRIBUTORS from .contributors import CONTRIBUTORS
@ -73,118 +60,12 @@ def index(request):
twitter_account_name = HomeOption.get_cached_value('twitter_account_name') twitter_account_name = HomeOption.get_cached_value('twitter_account_name')
asso_name = AssoOption.get_cached_value('pseudo') asso_name = AssoOption.get_cached_value('pseudo')
return form({ return form({
'services_urls': services, 'services_urls': services,
'twitter_url': twitter_url, 'twitter_url': twitter_url,
'twitter_account_name' : twitter_account_name, 'twitter_account_name': twitter_account_name,
'facebook_url': facebook_url, 'facebook_url': facebook_url,
'asso_name': asso_name 'asso_name': asso_name
}, 're2o/index.html', request) }, 're2o/index.html', request)
#: Binding the corresponding char sequence of history url to re2o models.
HISTORY_BIND = {
'users': {
'user': users.models.User,
'ban': users.models.Ban,
'whitelist': users.models.Whitelist,
'school': users.models.School,
'listright': users.models.ListRight,
'serviceuser': users.models.ServiceUser,
'listshell': users.models.ListShell,
},
'preferences': {
'service': preferences.models.Service,
},
'cotisations': {
'facture': cotisations.models.Facture,
'article': cotisations.models.Article,
'paiement': cotisations.models.Paiement,
'banque': cotisations.models.Banque,
},
'topologie': {
'switch': topologie.models.Switch,
'port': topologie.models.Port,
'room': topologie.models.Room,
'stack': topologie.models.Stack,
'modelswitch': topologie.models.ModelSwitch,
'constructorswitch': topologie.models.ConstructorSwitch,
'accesspoint': topologie.models.AccessPoint,
'switchbay': topologie.models.SwitchBay,
'building': topologie.models.Building,
},
'machines': {
'machine': machines.models.Machine,
'interface': machines.models.Interface,
'domain': machines.models.Domain,
'machinetype': machines.models.MachineType,
'iptype': machines.models.IpType,
'extension': machines.models.Extension,
'soa': machines.models.SOA,
'mx': machines.models.Mx,
'txt': machines.models.Txt,
'srv': machines.models.Srv,
'ns': machines.models.Ns,
'service': machines.models.Service,
'vlan': machines.models.Vlan,
'nas': machines.models.Nas,
'ipv6list': machines.models.Ipv6List,
},
}
@login_required
def history(request, application, object_name, object_id):
"""Render history for a model.
The model is determined using the `HISTORY_BIND` dictionnary if none is
found, raises a Http404. The view checks if the user is allowed to see the
history using the `can_view` method of the model.
Args:
request: The request sent by the user.
object_name: Name of the model.
object_id: Id of the object you want to acces history.
Returns:
The rendered page of history if access is granted, else the user is
redirected to their profile page, with an error message.
Raises:
Http404: This kind of models doesn't have history.
"""
try:
model = HISTORY_BIND[application][object_name]
except KeyError:
raise Http404(u"Il n'existe pas d'historique pour ce modèle.")
object_name_id = object_name + 'id'
kwargs = {object_name_id: object_id}
try:
instance = model.get_instance(**kwargs)
except model.DoesNotExist:
messages.error(request, u"Entrée inexistante")
return redirect(reverse(
'users:profil',
kwargs={'userid': str(request.user.id)}
))
can, msg = instance.can_view(request.user)
if not can:
messages.error(request, msg or "Vous ne pouvez pas accéder à ce menu")
return redirect(reverse(
'users:profil',
kwargs={'userid': str(request.user.id)}
))
pagination_number = GeneralOption.get_cached_value('pagination_number')
reversions = Version.objects.get_for_object(instance)
if hasattr(instance, 'linked_objects'):
for related_object in chain(instance.linked_objects()):
reversions = (reversions |
Version.objects.get_for_object(related_object))
reversions = re2o_paginator(request, reversions, pagination_number)
return render(
request,
're2o/history.html',
{'reversions': reversions, 'object': instance}
)
@cache_page(7 * 24 * 60 * 60) @cache_page(7 * 24 * 60 * 60)

View file

@ -21,7 +21,8 @@ You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url href name id %}"> {% load i18n %}
<i class="fa fa-history"></i> <a class="{{ class |default_if_none:"btn btn-info btn-sm"}}" role="button" title="Historique" href="{% url 'logs:history' application name id %}">
<i class="fa fa-history"></i> {% if text %}{% trans text %}{% endif %}
</a> </a>

View file

@ -23,52 +23,51 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
{% if ap_list.paginator %} {% if ap_list.paginator %}
{% include "pagination.html" with list=ap_list %} {% include "pagination.html" with list=ap_list %}
{% endif %} {% endif %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>{% include "buttons/sort.html" with prefix='ap' col='name' text='Borne' %}</th> <th>{% include "buttons/sort.html" with prefix='ap' col='name' text='Borne' %}</th>
<th>{% include "buttons/sort.html" with prefix='ap' col='mac' text='Addresse mac' %}</th> <th>{% include "buttons/sort.html" with prefix='ap' col='mac' text='Addresse mac' %}</th>
<th>{% include "buttons/sort.html" with prefix='ap' col='ip' text='Ipv4' %}</th> <th>{% include "buttons/sort.html" with prefix='ap' col='ip' text='Ipv4' %}</th>
<th>Commentaire</th> <th>Commentaire</th>
<th>Localisation</th> <th>Localisation</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
{% for ap in ap_list %} {% for ap in ap_list %}
<tr> <tr>
<td>{{ap.interface_set.first}}</td> <td>{{ap.interface_set.first}}</td>
<td>{{ap.interface_set.first.mac_address}}</td> <td>{{ap.interface_set.first.mac_address}}</td>
<td>{{ap.interface_set.first.ipv4}}</td> <td>{{ap.interface_set.first.ipv4}}</td>
<td>{{ap.interface_set.first.details}}</td> <td>{{ap.interface_set.first.details}}</td>
<td>{{ap.location}}</td> <td>{{ap.location}}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'accesspoint' ap.pk %}"> {% history_button ap %}
<i class="fa fa-history"></i> {% can_edit ap %}
</a> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-ap' ap.id %}">
{% can_edit ap %} <i class="fa fa-edit"></i>
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-ap' ap.id %}"> </a>
<i class="fa fa-edit"></i> {% acl_end %}
</a> {% can_delete ap %}
{% acl_end %} <a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'machines:del-machine' ap.id %}">
{% can_delete ap %} <i class="fa fa-trash"></i>
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'machines:del-machine' ap.id %}"> </a>
<i class="fa fa-trash"></i> {% acl_end %}
</a> </td>
{% acl_end %} </tr>
</td> {% endfor %}
</tr> </table>
{% endfor %}
</table>
{% if ap_list.paginator %} {% if ap_list.paginator %}
{% include "pagination.html" with list=ap_list %} {% include "pagination.html" with list=ap_list %}
{% endif %} {% endif %}
</div> </div>

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
{% if building_list.paginator %} {% if building_list.paginator %}
{% include "pagination.html" with list=building_list %} {% include "pagination.html" with list=building_list %}
@ -34,27 +35,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>{% include "buttons/sort.html" with prefix='building' col='name' text='Bâtiment' %}</th> <th>{% include "buttons/sort.html" with prefix='building' col='name' text='Bâtiment' %}</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
{% for building in building_list %} {% for building in building_list %}
<tr> <tr>
<td>{{building.name}}</td> <td>{{building.name}}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'building' building.pk %}"> {% history_button building %}
<i class="fa fa-history"></i> {% can_edit building %}
</a>
{% can_edit building %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-building' building.id %}"> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-building' building.id %}">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</a> </a>
{% acl_end %} {% acl_end %}
{% can_delete building %} {% can_delete building %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-building' building.id %}"> <a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-building' building.id %}">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</a> </a>
{% acl_end %} {% acl_end %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% if building_list.paginator %} {% if building_list.paginator %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
{% if room_list.paginator %} {% if room_list.paginator %}
{% include "pagination.html" with list=room_list %} {% include "pagination.html" with list=room_list %}
@ -35,28 +36,26 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>Commentaire</th> <th>Commentaire</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
{% for room in room_list %} {% for room in room_list %}
<tr> <tr>
<td>{{room.name}}</td> <td>{{room.name}}</td>
<td>{{room.details}}</td> <td>{{room.details}}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'room' room.pk %}"> {% history_button room %}
<i class="fa fa-history"></i> {% can_edit room %}
</a>
{% can_edit room %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-room' room.id %}"> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-room' room.id %}">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</a> </a>
{% acl_end %} {% acl_end %}
{% can_delete room %} {% can_delete room %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-room' room.id %}"> <a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-room' room.id %}">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</a> </a>
{% acl_end %} {% acl_end %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% if room_list.paginator %} {% if room_list.paginator %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
{% if constructor_switch_list.paginator %} {% if constructor_switch_list.paginator %}
{% include "pagination.html" with list=constructor_switch_list %} {% include "pagination.html" with list=constructor_switch_list %}
@ -34,27 +35,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>{% include "buttons/sort.html" with prefix='constructor-switch' col='name' text='Constructeur' %}</th> <th>{% include "buttons/sort.html" with prefix='constructor-switch' col='name' text='Constructeur' %}</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
{% for constructor_switch in constructor_switch_list %} {% for constructor_switch in constructor_switch_list %}
<tr> <tr>
<td>{{constructor_switch}}</td> <td>{{constructor_switch}}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'constructorswitch' constructor_switch.pk %}"> {% history_button constructor_switch %}
<i class="fa fa-history"></i> {% can_edit constructor_switch %}
</a>
{% can_edit constructor_switch %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-constructor-switch' constructor_switch.id %}"> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-constructor-switch' constructor_switch.id %}">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</a> </a>
{% acl_end %} {% acl_end %}
{% can_delete constructor_switch %} {% can_delete constructor_switch %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-constructor-switch' constructor_switch.id %}"> <a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-constructor-switch' constructor_switch.id %}">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</a> </a>
{% acl_end %} {% acl_end %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% if constructor_switch_list.paginator %} {% if constructor_switch_list.paginator %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
{% if model_switch_list.paginator %} {% if model_switch_list.paginator %}
{% include "pagination.html" with list=model_switch_list %} {% include "pagination.html" with list=model_switch_list %}
@ -33,30 +34,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr> <tr>
<th>{% include "buttons/sort.html" with prefix='model-switch' col='reference' text='Référence' %}</th> <th>{% include "buttons/sort.html" with prefix='model-switch' col='reference' text='Référence' %}</th>
<th>{% include "buttons/sort.html" with prefix='model-switch' col='constructor' text='Constructeur' %}</th> <th>{% include "buttons/sort.html" with prefix='model-switch' col='constructor' text='Constructeur' %}</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
{% for model_switch in model_switch_list %} {% for model_switch in model_switch_list %}
<tr> <tr>
<td>{{model_switch.reference}}</td> <td>{{model_switch.reference}}</td>
<td>{{model_switch.constructor}}</td> <td>{{model_switch.constructor}}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'modelswitch' model_switch.pk %}"> {% history_button model_switch %}
<i class="fa fa-history"></i> {% can_edit model_switch %}
</a>
{% can_edit model_switch %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-model-switch' model_switch.id %}"> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-model-switch' model_switch.id %}">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</a> </a>
{% acl_end %} {% acl_end %}
{% can_delete model_switch %} {% can_delete model_switch %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-model-switch' model_switch.id %}"> <a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-model-switch' model_switch.id %}">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</a> </a>
{% acl_end %} {% acl_end %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% if model_switch_list.paginator %} {% if model_switch_list.paginator %}

View file

@ -23,68 +23,67 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='port' col='port' text='Port' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='room' text='Room' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='interface' text='Interface machine' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='related' text='Related' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='radius' text='Radius' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='vlan' text='Vlan forcé' %}</th>
<th>Détails</th>
<th></th>
</tr>
</thead>
{% for port in port_list %}
<tr> <tr>
<th>{% include "buttons/sort.html" with prefix='port' col='port' text='Port' %}</th> <td>{{ port.port }}</td>
<th>{% include "buttons/sort.html" with prefix='port' col='room' text='Room' %}</th> <td>
<th>{% include "buttons/sort.html" with prefix='port' col='interface' text='Interface machine' %}</th> {% if port.room %}{{ port.room }}{% endif %}
<th>{% include "buttons/sort.html" with prefix='port' col='related' text='Related' %}</th> </td>
<th>{% include "buttons/sort.html" with prefix='port' col='radius' text='Radius' %}</th> <td>
<th>{% include "buttons/sort.html" with prefix='port' col='vlan' text='Vlan forcé' %}</th> {% if port.machine_interface %}
<th>Détails</th> {% can_view port.machine_interface.machine.user %}
<th></th> <a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}">
</tr> {{ port.machine_interface }}
</thead> </a>
{% for port in port_list %} {% acl_else %}
<tr>
<td>{{ port.port }}</td>
<td>
{% if port.room %}{{ port.room }}{% endif %}
</td>
<td>
{% if port.machine_interface %}
{% can_view port.machine_interface.machine.user %}
<a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}">
{{ port.machine_interface }} {{ port.machine_interface }}
</a> {% acl_end %}
{% acl_else %} {% endif %}
{{ port.machine_interface }} </td>
{% acl_end %} <td>
{% endif %} {% if port.related %}
</td> {% can_view port.related.switch %}
<td> <a href="{% url 'topologie:index-port' switchid=port.related.switch.id %}">
{% if port.related %} {{ port.related }}
{% can_view port.related.switch %} </a>
<a href="{% url 'topologie:index-port' switchid=port.related.switch.id %}"> {% acl_else %}
{{ port.related }} {{ port.related }}
</a> {% acl_end %}
{% acl_else %} {% endif %}
{{ port.related }} </td>
{% acl_end %} <td>{{ port.radius }}</td>
{% endif %} <td>{% if not port.vlan_force %}Aucun{% else %}{{ port.vlan_force }}{% endif %}</td>
</td> <td>{{ port.details }}</td>
<td>{{ port.radius }}</td> <td class="text-right">
<td>{% if not port.vlan_force %}Aucun{% else %}{{ port.vlan_force }}{% endif %}</td> {% history_button port %}
<td>{{ port.details }}</td> {% can_edit port %}
<td class="text-right"> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-port' port.id %}">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'port' port.pk %}"> <i class="fa fa-edit"></i>
<i class="fa fa-history"></i> </a>
</a> {% acl_end %}
{% can_edit port %} {% can_delete port %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-port' port.id %}"> <a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-port' port.pk %}">
<i class="fa fa-edit"></i> <i class="fa fa-trash"></i>
</a> </a>
{% acl_end %} {% acl_end %}
{% can_delete port %} </td>
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-port' port.pk %}"> </tr>
<i class="fa fa-trash"></i> {% endfor %}
</a> </table>
{% acl_end %}
</td>
</tr>
{% endfor %}
</table>
</div> </div>

View file

@ -27,90 +27,90 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="table-responsive" style="font-size: 12px"> <div class="table-responsive" style="font-size: 12px">
<table class="table table-bordered text-center text-nowrap"> <table class="table table-bordered text-center text-nowrap">
<thead> <thead>
<tr> <tr>
{% for port in port_list|slice:"::2" %} {% for port in port_list|slice:"::2" %}
<td class="bg-primary text-white">{{ port.port }}</td> <td class="bg-primary text-white">{{ port.port }}</td>
{% endfor %} {% endfor %}
</tr> </tr>
<tr> <tr>
{% for port in port_list|slice:"::2" %} {% for port in port_list|slice:"::2" %}
{% if port.room %} {% if port.room %}
<td class="p-3 mb-2 bg-success text-dark"> <td class="p-3 mb-2 bg-success text-dark">
{{ port.room }} {{ port.room }}
</td> </td>
{% elif port.machine_interface %} {% elif port.machine_interface %}
<td class="p-3 mb-2 bg-warning text-dark"> <td class="p-3 mb-2 bg-warning text-dark">
{% can_view port.machine_interface.machine.user %} {% can_view port.machine_interface.machine.user %}
<a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}"> <a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}">
{{ port.machine_interface }}
</a>
{% acl_else %}
{{ port.machine_interface }} {{ port.machine_interface }}
</a> {% acl_end %}
{% acl_else %} </td>
{{ port.machine_interface }} {% elif port.related%}
{% acl_end %} <td class="p-3 mb-2 bg-danger text-dark">
</td> {% can_view port.related.switch %}
{% elif port.related%} <a href="{% url 'topologie:index-port' switchid=port.related.switch.id %}">
<td class="p-3 mb-2 bg-danger text-dark"> {{ port.related }}
{% can_view port.related.switch %} </a>
<a href="{% url 'topologie:index-port' switchid=port.related.switch.id %}"> {% acl_else %}
{{ port.related }} {{ port.related }}
</a> {% acl_end %}
{% acl_else %} </td>
{{ port.related }} {% else %}
{% acl_end %} <td class="p-3 mb-2 bg-info text-dark">
</td> Vide
{% else %} </td>
<td class="p-3 mb-2 bg-info text-dark"> {% endif %}
Vide {% endfor %}
</td>
{% endif %}
{% endfor %}
</tr>
<tr> </tr>
{% for port in port_list|slice:"1::2" %} <tr>
<td class="bg-primary text-white">{{ port.port }}</td>
{% endfor %}
</tr> {% for port in port_list|slice:"1::2" %}
<tr> <td class="bg-primary text-white">{{ port.port }}</td>
{% endfor %}
{% for port in port_list|slice:"1::2" %} </tr>
{% if port.room %} <tr>
<td class="p-3 mb-2 bg-success text-dark">
{{ port.room }} {% for port in port_list|slice:"1::2" %}
</td> {% if port.room %}
{% elif port.machine_interface %} <td class="p-3 mb-2 bg-success text-dark">
<td class="p-3 mb-2 bg-warning text-dark"> {{ port.room }}
{% can_view port.machine_interface.machine.user %} </td>
<a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}"> {% elif port.machine_interface %}
<td class="p-3 mb-2 bg-warning text-dark">
{% can_view port.machine_interface.machine.user %}
<a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}">
{{ port.machine_interface }}
</a>
{% acl_else %}
{{ port.machine_interface }} {{ port.machine_interface }}
</a> {% acl_end %}
{% acl_else %} </td>
{{ port.machine_interface }} {% elif port.related%}
{% acl_end %} <td class="p-3 mb-2 bg-danger text-dark">
</td> {% can_view port.related.switch %}
{% elif port.related%} <a href="{% url 'topologie:index-port' switchid=port.related.switch.id %}">
<td class="p-3 mb-2 bg-danger text-dark"> {{ port.related }}
{% can_view port.related.switch %} </a>
<a href="{% url 'topologie:index-port' switchid=port.related.switch.id %}"> {% acl_else %}
{{ port.related }} {{ port.related }}
</a> {% acl_end %}
{% acl_else %} </td>
{{ port.related }} {% else %}
{% acl_end %} <td class="p-3 mb-2 bg-info text-dark">
</td> Vide
{% else %} </td>
<td class="p-3 mb-2 bg-info text-dark"> {% endif %}
Vide {% endfor %}
</td>
{% endif %} </tr>
{% endfor %}
</tr>
</table> </table>
</div> </div>

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -33,29 +34,27 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>Membres</th> <th>Membres</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
{% for stack in stack_list %} {% for stack in stack_list %}
<tr> <tr>
<td>{{ stack.name }}</td> <td>{{ stack.name }}</td>
<td>{{stack.stack_id}}</td> <td>{{stack.stack_id}}</td>
<td>{{stack.details}}</td> <td>{{stack.details}}</td>
<td>{% for switch in stack.switch_set.all %}<a href="{% url 'topologie:index-port' switch.pk %}">{{switch }} </a>{% endfor %}</td> <td>{% for switch in stack.switch_set.all %}<a href="{% url 'topologie:index-port' switch.pk %}">{{switch }} </a>{% endfor %}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'stack' stack.pk %}"> {% history_button stack %}
<i class="fa fa-history"></i> {% can_edit stack %}
</a> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}">
{% can_edit stack %} <i class="fa fa-edit"></i>
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}"> </a>
<i class="fa fa-edit"></i> {% acl_end %}
</a> {% can_delete stack %}
{% acl_end %} <a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-stack' stack.pk %}">
{% can_delete stack %} <i class="fa fa-trash"></i>
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-stack' stack.pk %}"> </a>
<i class="fa fa-trash"></i> {% acl_end %}
</a>
{% acl_end %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -23,59 +23,60 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
{% if switch_list.paginator %} {% if switch_list.paginator %}
{% include "pagination.html" with list=switch_list %} {% include "pagination.html" with list=switch_list %}
{% endif %} {% endif %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='switch' col='dns' text='Dns' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='ip' text='Ipv4' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='loc' text='Emplacement' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='ports' text='Ports' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='stack' text='Stack' %}</th>
<th>Id stack</th>
<th>Modèle</th>
<th>Détails</th>
<th></th>
</tr>
</thead>
{% for switch in switch_list %}
<tr> <tr>
<th>{% include "buttons/sort.html" with prefix='switch' col='dns' text='Dns' %}</th> <td>
<th>{% include "buttons/sort.html" with prefix='switch' col='ip' text='Ipv4' %}</th> <a title="Configuer" href="{% url 'topologie:index-port' switch.pk %}">
<th>{% include "buttons/sort.html" with prefix='switch' col='loc' text='Emplacement' %}</th> {{switch}}
<th>{% include "buttons/sort.html" with prefix='switch' col='ports' text='Ports' %}</th> </a>
<th>{% include "buttons/sort.html" with prefix='switch' col='stack' text='Stack' %}</th> </td>
<th>Id stack</th> <td>{{switch.interface_set.first.ipv4}}</td>
<th>Modèle</th> <td>{{switch.switchbay}}</td>
<th>Détails</th> <td>{{switch.number}}</td>
<th></th> <td>{{switch.stack.name}}</td>
<td>{{switch.stack_member_id}}</td>
<td>{{switch.model}}</td>
<td>{{switch.interface_set.first.details}}</td>
<td class="text-right">
{% history_button switch %}
{% can_edit switch %}
{% include 'buttons/edit.html' with href='topologie:edit-switch' id=switch.pk %}
{% acl_end %}
{% can_delete switch %}
{% include 'buttons/suppr.html' with href='machines:del-machine' id=switch.id %}
{% acl_end %}
{% can_create Port %}
{% include 'buttons/add.html' with href='topologie:create-ports' id=switch.pk desc='Création de ports'%}
{% acl_end %}
</td>
</tr> </tr>
</thead> {% endfor %}
{% for switch in switch_list %} </table>
<tr>
<td>
<a title="Configuer" href="{% url 'topologie:index-port' switch.pk %}">
{{switch}}
</a>
</td>
<td>{{switch.interface_set.first.ipv4}}</td>
<td>{{switch.switchbay}}</td>
<td>{{switch.number}}</td>
<td>{{switch.stack.name}}</td>
<td>{{switch.stack_member_id}}</td>
<td>{{switch.model}}</td>
<td>{{switch.interface_set.first.details}}</td>
<td class="text-right">
{% include 'buttons/history.html' with href='topologie:history' name='switch' id=switch.pk%}
{% can_edit switch %}
{% include 'buttons/edit.html' with href='topologie:edit-switch' id=switch.pk %}
{% acl_end %}
{% can_delete switch %}
{% include 'buttons/suppr.html' with href='machines:del-machine' id=switch.id %}
{% acl_end %}
{% can_create Port %}
{% include 'buttons/add.html' with href='topologie:create-ports' id=switch.pk desc='Création de ports'%}
{% acl_end %}
</td>
</tr>
{% endfor %}
</table>
{% if switch_list.paginator %} {% if switch_list.paginator %}
{% include "pagination.html" with list=switch_list %} {% include "pagination.html" with list=switch_list %}
{% endif %} {% endif %}
</div> </div>

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
{% if switch_bay_list.paginator %} {% if switch_bay_list.paginator %}
{% include "pagination.html" with list=switch_bay_list %} {% include "pagination.html" with list=switch_bay_list %}
@ -32,35 +33,33 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<thead> <thead>
<tr> <tr>
<th>{% include "buttons/sort.html" with prefix='switch-bay' col='name' text='Baie' %}</th> <th>{% include "buttons/sort.html" with prefix='switch-bay' col='name' text='Baie' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch-bay' col='building' text='Bâtiment' %}</th> <th>{% include "buttons/sort.html" with prefix='switch-bay' col='building' text='Bâtiment' %}</th>
<th>Info particulières</th> <th>Info particulières</th>
<th>Switchs de la baie</th> <th>Switchs de la baie</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
{% for switch_bay in switch_bay_list %} {% for switch_bay in switch_bay_list %}
<tr> <tr>
<td>{{switch_bay.name}}</td> <td>{{switch_bay.name}}</td>
<td>{{switch_bay.building}}</td> <td>{{switch_bay.building}}</td>
<td>{{switch_bay.info}}</td> <td>{{switch_bay.info}}</td>
<td>{% for switch in switch_bay.switch_set.all %}<a href="{% url 'topologie:index-port' switch.pk %}">{{switch }} </a>{% endfor %}</td> <td>{% for switch in switch_bay.switch_set.all %}<a href="{% url 'topologie:index-port' switch.pk %}">{{switch }} </a>{% endfor %}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'switchbay' switch_bay.pk %}"> {% history_button switch_bay %}
<i class="fa fa-history"></i> {% can_edit switch_bay %}
</a>
{% can_edit switch_bay %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-switch-bay' switch_bay.id %}"> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-switch-bay' switch_bay.id %}">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</a> </a>
{% acl_end %} {% acl_end %}
{% can_delete switch_bay %} {% can_delete switch_bay %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-switch-bay' switch_bay.id %}"> <a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-switch-bay' switch_bay.id %}">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</a> </a>
{% acl_end %} {% acl_end %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% if switch_bay_list.paginator %} {% if switch_bay_list.paginator %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -31,27 +32,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>ID</th> <th>ID</th>
<th>Details</th> <th>Details</th>
</tr> </tr>
</thead> </thead>
{% for stack in stack_list %} {% for stack in stack_list %}
<tr> <tr>
<td>{{stack.name}}</td> <td>{{stack.name}}</td>
<td>{{stack.stack_id}}</td> <td>{{stack.stack_id}}</td>
<td>{{stack.details}}</td> <td>{{stack.details}}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'stack' stack.pk %}"> {% history_button stack %}
<i class="fa fa-history"></i> {% can_edit stack %}
</a> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}">
{% can_edit stack %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</a> </a>
{% acl_end %} {% acl_end %}
{% can_delete stack %} {% can_delete stack %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-stack' stack.pk %}"> <a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-stack' stack.pk %}">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</a> </a>
{% acl_end %} {% acl_end %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -30,7 +30,6 @@ from __future__ import unicode_literals
from django.conf.urls import url from django.conf.urls import url
import re2o
from . import views from . import views
urlpatterns = [ urlpatterns = [
@ -51,10 +50,6 @@ urlpatterns = [
url(r'^switch/(?P<switchid>[0-9]+)$', url(r'^switch/(?P<switchid>[0-9]+)$',
views.index_port, views.index_port,
name='index-port'), name='index-port'),
url(r'^history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
re2o.views.history,
name='history',
kwargs={'application': 'topologie'}),
url(r'^edit_port/(?P<portid>[0-9]+)$', views.edit_port, name='edit-port'), url(r'^edit_port/(?P<portid>[0-9]+)$', views.edit_port, name='edit-port'),
url(r'^new_port/(?P<switchid>[0-9]+)$', views.new_port, name='new-port'), url(r'^new_port/(?P<switchid>[0-9]+)$', views.new_port, name='new-port'),
url(r'^del_port/(?P<portid>[0-9]+)$', views.del_port, name='del-port'), url(r'^del_port/(?P<portid>[0-9]+)$', views.del_port, name='del-port'),

View file

@ -22,42 +22,43 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
{% if ban_list.paginator %} {% if ban_list.paginator %}
{% include "pagination.html" with list=ban_list %} {% include "pagination.html" with list=ban_list %}
{% endif %} {% endif %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>{% include "buttons/sort.html" with prefix='ban' col="user" text="Utilisateur" %}</th> <th>{% include "buttons/sort.html" with prefix='ban' col="user" text="Utilisateur" %}</th>
<th>Raison</th> <th>Raison</th>
<th>{% include "buttons/sort.html" with prefix='ban' col="start" text="Date de début" %}</th> <th>{% include "buttons/sort.html" with prefix='ban' col="start" text="Date de début" %}</th>
<th>{% include "buttons/sort.html" with prefix='ban' col="end" text="Date de fin" %}</th> <th>{% include "buttons/sort.html" with prefix='ban' col="end" text="Date de fin" %}</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
{% for ban in ban_list %} {% for ban in ban_list %}
{% if ban.is_active %} {% if ban.is_active %}
<tr class="danger"> <tr class="danger">
{% else %} {% else %}
<tr> <tr>
{% endif %} {% endif %}
<td>{{ ban.user }}</td> <td>{{ ban.user }}</td>
<td>{{ ban.raison }}</td> <td>{{ ban.raison }}</td>
<td>{{ ban.date_start }}</td> <td>{{ ban.date_start }}</td>
<td>{{ ban.date_end }}</td> <td>{{ ban.date_end }}</td>
<td class="text-right"> <td class="text-right">
{% can_delete ban %} {% can_delete ban %}
{% include 'buttons/suppr.html' with href='users:del-ban' id=ban.id %} {% include 'buttons/suppr.html' with href='users:del-ban' id=ban.id %}
{% acl_end %} {% acl_end %}
{% can_edit ban %} {% can_edit ban %}
{% include 'buttons/edit.html' with href='users:edit-ban' id=ban.id %} {% include 'buttons/edit.html' with href='users:edit-ban' id=ban.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='users:history' name='ban' id=ban.id %} {% history_button ban %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% if ban_list.paginator %} {% if ban_list.paginator %}
{% include "pagination.html" with list=ban_list %} {% include "pagination.html" with list=ban_list %}

View file

@ -28,36 +28,36 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %} {% load acl %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>{% include "buttons/sort.html" with prefix='club' col="surname" text="Nom" %}</th> <th>{% include "buttons/sort.html" with prefix='club' col="surname" text="Nom" %}</th>
<th>{% include "buttons/sort.html" with prefix='club' col="pseudo" text="Pseudo" %}</th> <th>{% include "buttons/sort.html" with prefix='club' col="pseudo" text="Pseudo" %}</th>
<th>{% include "buttons/sort.html" with prefix='club' col="room" text="Chambre" %}</th> <th>{% include "buttons/sort.html" with prefix='club' col="room" text="Chambre" %}</th>
<th>Fin de cotisation le</th> <th>Fin de cotisation le</th>
<th>Connexion</th> <th>Connexion</th>
<th>Profil</th> <th>Profil</th>
</tr>
</thead>
{% for club in clubs_list %}
{% can_view club %}
<tr>
<td>{{ club.surname }}</td>
<td>{{ club.pseudo }}</td>
<td>{{ club.room }}</td>
<td>{% if club.is_adherent %}{{ club.end_adhesion }}{% else %}Non adhérent{% endif %}</td>
<td>{% if club.has_access == True %}
<i class="text-success">Active</i>
{% else %}
<i class="text-danger">Désactivée</i>
{% endif %}
</td>
<td><a href="{% url "users:profil" club.id%}" class="btn btn-primary btn-sm" role="button"><i class="fa fa-user"></i></a>
</td>
</tr> </tr>
{% acl_end %} </thead>
{% endfor %} {% for club in clubs_list %}
</table> {% can_view club %}
<tr>
<td>{{ club.surname }}</td>
<td>{{ club.pseudo }}</td>
<td>{{ club.room }}</td>
<td>{% if club.is_adherent %}{{ club.end_adhesion }}{% else %}Non adhérent{% endif %}</td>
<td>{% if club.has_access == True %}
<i class="text-success">Active</i>
{% else %}
<i class="text-danger">Désactivée</i>
{% endif %}
</td>
<td><a href="{% url "users:profil" club.id%}" class="btn btn-primary btn-sm" role="button"><i class="fa fa-user"></i></a>
</td>
</tr>
{% acl_end %}
{% endfor %}
</table>
{% if clubs_list.paginator %} {% if clubs_list.paginator %}
{% include "pagination.html" with list=clubs_list %} {% include "pagination.html" with list=clubs_list %}

View file

@ -23,20 +23,21 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load i18n %} {% load i18n %}
{% load logs_extra %}
{% if superusers.count %} {% if superusers.count %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading clearfix" data-toggle="collapse" data-target="#collapse_superuser"> <div class="panel-heading clearfix" data-toggle="collapse" data-target="#collapse_superuser">
<div class="pull-right"> <div class="pull-right">
<a type="button" class="btn btn-sm btn-default" data-toggle="modal" data-target="#modal_superuser"> <a type="button" class="btn btn-sm btn-default" data-toggle="modal" data-target="#modal_superuser">
{{superusers.count}} <i class="fa fa-user"></i> {{superusers.count}} <i class="fa fa-user"></i>
</a> </a>
</div> </div>
<h4 class="text-danger"> <h4 class="text-danger">
<i class="fa fa-address-book"></i> <i class="fa fa-address-book"></i>
{% trans "Superuser" %} {% trans "Superuser" %}
</h4> </h4>
{% trans "Django's specific pre-defined right that supersed any other rights." %} {% trans "Django's specific pre-defined right that supersed any other rights." %}
</div> </div>
<div class="panel-collapse collapse" id="collapse_superuser"> <div class="panel-collapse collapse" id="collapse_superuser">
<div class="panel-body"> <div class="panel-body">
@ -106,24 +107,24 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% for right, users in rights.items %} {% for right, users in rights.items %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading clearfix" data-toggle="collapse" data-target="#collapse_{{right.id}}"> <div class="panel-heading clearfix" data-toggle="collapse" data-target="#collapse_{{right.id}}">
<div class="pull-right"> <div class="pull-right">
{% if users %} {% if users %}
<a type="button" class="btn btn-sm btn-default" data-toggle="modal" data-target="#modal_{{right.id}}"> <a type="button" class="btn btn-sm btn-default" data-toggle="modal" data-target="#modal_{{right.id}}">
{% else %} {% else %}
<a type="button" class="btn btn-sm btn-default" disabled="disabled"> <a type="button" class="btn btn-sm btn-default" disabled="disabled">
{% endif %} {% endif %}
{{users.count}} <i class="fa fa-user"></i> {{users.count}} <i class="fa fa-user"></i>
</a> </a>
{% include 'buttons/edit.html' with href='users:edit-listright' id=right.id %} {% include 'buttons/edit.html' with href='users:edit-listright' id=right.id %}
{% include 'buttons/history.html' with href='users:history' name='listright' id=right.id %} {% history_button right %}
</div> </div>
<h4 class="{% if right.critical %}text-danger{% endif %}"> <h4 class="{% if right.critical %}text-danger{% endif %}">
<i class="fa fa-address-book"></i> <i class="fa fa-address-book"></i>
{% blocktrans trimmed with right.name as right_name and right.gid as right_gid %} {% blocktrans trimmed with right.name as right_name and right.gid as right_gid %}
{{ right_name }} (gid: {{ right_gid }}) {{ right_name }} (gid: {{ right_gid }})
{% endblocktrans %} {% endblocktrans %}
</h4> </h4>
{{ right.details }} {{ right.details }}
</div> </div>
<div class="panel-collapse collapse" id="collapse_{{right.id}}"> <div class="panel-collapse collapse" id="collapse_{{right.id}}">
<div class="panel-body"> <div class="panel-body">

View file

@ -22,20 +22,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
{% for right in right_list %}
<th>{{ right }}</th>
<th></th>
{% endfor %}
</tr>
</thead>
{% for user_right in user_right_list %}
<tr> <tr>
<td> {{ user_right }}</td> {% for right in right_list %}
<th>{{ right }}</th>
<th></th>
{% endfor %}
</tr> </tr>
{% endfor %} </thead>
</table> {% for user_right in user_right_list %}
<tr>
<td> {{ user_right }}</td>
</tr>
{% endfor %}
</table>

View file

@ -22,18 +22,19 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
{% if school_list.paginator %} {% if school_list.paginator %}
{% include "pagination.html" with list=school_list %} {% include "pagination.html" with list=school_list %}
{% endif %} {% endif %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>{% include "buttons/sort.html" with prefix='school' col='name' text='Etablissement' %}</th> <th>{% include "buttons/sort.html" with prefix='school' col='name' text='Etablissement' %}</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
@ -44,14 +45,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit school %} {% can_edit school %}
{% include 'buttons/edit.html' with href='users:edit-school' id=school.id %} {% include 'buttons/edit.html' with href='users:edit-school' id=school.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='users:history' name='school' id=school.id %} {% history_button school %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% if school_list.paginator %} {% if school_list.paginator %}
{% include "pagination.html" with list=school_list %} {% include "pagination.html" with list=school_list %}
{% endif %} {% endif %}
</div> </div>

View file

@ -22,30 +22,31 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
<table class="table table-striped"> {% load logs_extra %}
<thead> <table class="table table-striped">
<tr> <thead>
<th>Nom</th>
<th>Rôle</th>
<th>Commentaire</th>
<th></th>
</tr>
</thead>
{% for serviceuser in serviceusers_list %}
<tr> <tr>
<td>{{ serviceuser.pseudo }}</td> <th>Nom</th>
<td>{{ serviceuser.access_group }}</td> <th>Rôle</th>
<td>{{ serviceuser.comment }}</td> <th>Commentaire</th>
<td class="text-right"> <th></th>
{% can_delete serviceuser %}
{% include 'buttons/suppr.html' with href='users:del-serviceuser' id=serviceuser.id %}
{% acl_end %}
{% can_edit serviceuser %}
{% include 'buttons/edit.html' with href='users:edit-serviceuser' id=serviceuser.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='users:history' name='serviceuser' id=serviceuser.id %}
</td>
</tr> </tr>
{% endfor %} </thead>
</table> {% for serviceuser in serviceusers_list %}
<tr>
<td>{{ serviceuser.pseudo }}</td>
<td>{{ serviceuser.access_group }}</td>
<td>{{ serviceuser.comment }}</td>
<td class="text-right">
{% can_delete serviceuser %}
{% include 'buttons/suppr.html' with href='users:del-serviceuser' id=serviceuser.id %}
{% acl_end %}
{% can_edit serviceuser %}
{% include 'buttons/edit.html' with href='users:edit-serviceuser' id=serviceuser.id %}
{% acl_end %}
{% history_button serviceuser %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -22,26 +22,27 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
<table class="table table-striped"> {% load logs_extra %}
<thead> <table class="table table-striped">
<tr> <thead>
<th>Shell</th>
<th></th>
</tr>
</thead>
{% for shell in shell_list %}
<tr> <tr>
<td>{{ shell.shell }}</td> <th>Shell</th>
<td class="text-right"> <th></th>
{% can_delete shell %}
{% include 'buttons/suppr.html' with href='users:del-shell' id=shell.id %}
{% acl_end %}
{% can_edit shell %}
{% include 'buttons/edit.html' with href='users:edit-shell' id=shell.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='users:history' name='listshell' id=shell.id %}
</td>
</tr> </tr>
{% endfor %} </thead>
</table> {% for shell in shell_list %}
<tr>
<td>{{ shell.shell }}</td>
<td class="text-right">
{% can_delete shell %}
{% include 'buttons/suppr.html' with href='users:del-shell' id=shell.id %}
{% acl_end %}
{% can_edit shell %}
{% include 'buttons/edit.html' with href='users:edit-shell' id=shell.id %}
{% acl_end %}
{% history_button shell %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -22,9 +22,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
<div class="table-responsive"> <div class="table-responsive">
{% if users_list.paginator %} {% if users_list.paginator %}
{% include "pagination.html" with list=users_list %} {% include "pagination.html" with list=users_list %}
{% endif %} {% endif %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -57,7 +57,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endfor %} {% endfor %}
</table> </table>
{% if users_list.paginator %} {% if users_list.paginator %}
{% include "pagination.html" with list=users_list %} {% include "pagination.html" with list=users_list %}
{% endif %} {% endif %}
</div> </div>

View file

@ -26,38 +26,39 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include "pagination.html" with list=white_list %} {% include "pagination.html" with list=white_list %}
{% endif %} {% endif %}
{% load acl %} {% load acl %}
<table class="table table-striped"> {% load logs_extra %}
<thead> <table class="table table-striped">
<tr> <thead>
<th>{% include "buttons/sort.html" with prefix='white' col="user" text="Utilisateur" %}</th> <tr>
<th>Raison</th> <th>{% include "buttons/sort.html" with prefix='white' col="user" text="Utilisateur" %}</th>
<th>{% include "buttons/sort.html" with prefix='white' col="start" text="Date de début" %}</th> <th>Raison</th>
<th>{% include "buttons/sort.html" with prefix='white' col="end" text="Date de fin" %}</th> <th>{% include "buttons/sort.html" with prefix='white' col="start" text="Date de début" %}</th>
<th></th> <th>{% include "buttons/sort.html" with prefix='white' col="end" text="Date de fin" %}</th>
</tr> <th></th>
</thead> </tr>
{% for whitelist in white_list %} </thead>
{% if whitelist.is_active %} {% for whitelist in white_list %}
<tr class="success"> {% if whitelist.is_active %}
<tr class="success">
{% else %} {% else %}
<tr> <tr>
{% endif %} {% endif %}
<td>{{ whitelist.user }}</td> <td>{{ whitelist.user }}</td>
<td>{{ whitelist.raison }}</td> <td>{{ whitelist.raison }}</td>
<td>{{ whitelist.date_start }}</td> <td>{{ whitelist.date_start }}</td>
<td>{{ whitelist.date_end }}</td> <td>{{ whitelist.date_end }}</td>
<td class="text-right"> <td class="text-right">
{% can_delete whitelist %} {% can_delete whitelist %}
{% include 'buttons/suppr.html' with href='users:del-whitelist' id=whitelist.id %} {% include 'buttons/suppr.html' with href='users:del-whitelist' id=whitelist.id %}
{% acl_end %} {% acl_end %}
{% can_edit whitelist %} {% can_edit whitelist %}
{% include 'buttons/edit.html' with href='users:edit-whitelist' id=whitelist.id %} {% include 'buttons/edit.html' with href='users:edit-whitelist' id=whitelist.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='users:history' name='whitelist' id=whitelist.id %} {% history_button whitelist %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% if white_list.paginator %} {% if white_list.paginator %}
{% include "pagination.html" with list=white_list %} {% include "pagination.html" with list=white_list %}

View file

@ -25,12 +25,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load bootstrap3 %} {% load bootstrap3 %}
{% load acl %} {% load acl %}
{% load logs_extra %}
{% block title %}Profil{% endblock %} {% block title %}Profil{% endblock %}
{% block content %} {% block content %}
<h2>{{ users.surname }} {{users.name}}</h2> <h2>{{ users.surname }} {{users.name}}</h2>
<p>Vous êtes {% if users.end_adhesion != None %}<span class="label label-success"> <p>Vous êtes {% if users.end_adhesion != None %}<span class="label label-success">
un {{ users.class_name | lower}}</span>{% else %}<span class="label label-danger"> un {{ users.class_name | lower}}</span>{% else %}<span class="label label-danger">
non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %} non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
<span class="label label-success">active</span>{% else %}<span class="label label-danger">désactivée</span>{% endif %}.</p> <span class="label label-success">active</span>{% else %}<span class="label label-danger">désactivée</span>{% endif %}.</p>
{% if user_solde %} {% if user_solde %}
<p>Votre solde est de <span class="badge">{{ users.solde }}€</span>. <p>Votre solde est de <span class="badge">{{ users.solde }}€</span>.
@ -49,134 +50,131 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
</h3> </h3>
</div> </div>
<div class="panel-collapse collapse in" id="collapse1"> <div class="panel-collapse collapse in" id="collapse1">
<div class="panel-body"> <div class="panel-body">
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-info' users.id %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-info' users.id %}">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
Editer Editer
</a> </a>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:password' users.id %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'users:password' users.id %}">
<i class="fa fa-lock"></i> <i class="fa fa-lock"></i>
Changer le mot de passe Changer le mot de passe
</a> </a>
{% can_change User state %} {% can_change User state %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' users.id %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' users.id %}">
<i class="fa fa-id-badge"></i> <i class="fa fa-id-badge"></i>
Changer le statut Changer le statut
</a> </a>
{% acl_end %} {% acl_end %}
{% can_change User groups %} {% can_change User groups %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:groups' users.id %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'users:groups' users.id %}">
<i class="fa fa-check"></i> <i class="fa fa-check"></i>
Gérer les groupes Gérer les groupes
</a> </a>
{% acl_end %} {% acl_end %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:history' 'user' users.id %}"> {% history_button users text="History" %}
<i class="fa fa-history"></i>
Historique
</a>
</ul> </ul>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
{% if users.is_class_club %} {% if users.is_class_club %}
<th>Mailing</th> <th>Mailing</th>
{% if users.club.mailing %} {% if users.club.mailing %}
<td>{{ users.pseudo }}(-admin)</td> <td>{{ users.pseudo }}(-admin)</td>
{% else %} {% else %}
<td>Mailing désactivée</td> <td>Mailing désactivée</td>
{% endif %} {% endif %}
{% else %} {% else %}
<th>Prénom</th> <th>Prénom</th>
<td>{{ users.name }}</td> <td>{{ users.name }}</td>
{% endif %} {% endif %}
<th>Nom</th> <th>Nom</th>
<td>{{ users.surname }}</td> <td>{{ users.surname }}</td>
</tr> </tr>
<tr> <tr>
<th>Pseudo</th> <th>Pseudo</th>
<td>{{ users.pseudo }}</td> <td>{{ users.pseudo }}</td>
<th>E-mail</th> <th>E-mail</th>
<td>{{ users.email }}</td> <td>{{ users.email }}</td>
</tr> </tr>
<tr> <tr>
<th>Chambre</th> <th>Chambre</th>
<td>{{ users.room }}</td> <td>{{ users.room }}</td>
<th>Téléphone</th> <th>Téléphone</th>
<td>{{ users.telephone }}</td> <td>{{ users.telephone }}</td>
</tr> </tr>
<tr> <tr>
<th>École</th> <th>École</th>
<td>{{ users.school }}</td> <td>{{ users.school }}</td>
<th>Commentaire</th> <th>Commentaire</th>
<td>{{ users.comment }}</td> <td>{{ users.comment }}</td>
</tr> </tr>
<tr> <tr>
<th>Date d'inscription</th> <th>Date d'inscription</th>
<td>{{ users.registered }}</td> <td>{{ users.registered }}</td>
<th>Dernière connexion</th> <th>Dernière connexion</th>
<td>{{ users.last_login }}</td> <td>{{ users.last_login }}</td>
</tr> </tr>
<tr> <tr>
<th>Fin d'adhésion</th> <th>Fin d'adhésion</th>
{% if users.end_adhesion != None %} {% if users.end_adhesion != None %}
<td><i class="text-success">{{ users.end_adhesion }}</i></td> <td><i class="text-success">{{ users.end_adhesion }}</i></td>
{% else %} {% else %}
<td><i class="text-danger">Non adhérent</i></td> <td><i class="text-danger">Non adhérent</i></td>
{% endif %} {% endif %}
<th>Accès gracieux</th> <th>Accès gracieux</th>
{% if users.end_whitelist != None %} {% if users.end_whitelist != None %}
<td><i class="text-success">{{ users.end_whitelist }}</i></td> <td><i class="text-success">{{ users.end_whitelist }}</i></td>
{% else %} {% else %}
<td><i class="text-warning">Aucun</i></td> <td><i class="text-warning">Aucun</i></td>
{% endif %} {% endif %}
<tr> <tr>
<th>Bannissement</th> <th>Bannissement</th>
{% if users.end_ban != None %} {% if users.end_ban != None %}
<td><i class="text-danger">{{ users.end_ban }}</i></td> <td><i class="text-danger">{{ users.end_ban }}</i></td>
{% else %} {% else %}
<td><i class="text-success">Non banni</i></td> <td><i class="text-success">Non banni</i></td>
{% endif %} {% endif %}
<th>Statut</th> <th>Statut</th>
{% if users.state == 0 %} {% if users.state == 0 %}
<td><i class="text-success">Actif</i></td> <td><i class="text-success">Actif</i></td>
{% elif users.state == 1 %} {% elif users.state == 1 %}
<td><i class="text-danger">Désactivé</i></td> <td><i class="text-danger">Désactivé</i></td>
{% else %} {% else %}
<td><i class="text-warning">Archivé</i></td> <td><i class="text-warning">Archivé</i></td>
{% endif %} {% endif %}
</tr> </tr>
<tr> <tr>
<th>Accès internet</th> <th>Accès internet</th>
{% if users.has_access == True %} {% if users.has_access == True %}
<td><i class="text-success">Actif (jusqu'au {{ users.end_access }})</i></td> <td><i class="text-success">Actif (jusqu'au {{ users.end_access }})</i></td>
{% else %} {% else %}
<td><i class="text-danger">Désactivé</i></td> <td><i class="text-danger">Désactivé</i></td>
{% endif %} {% endif %}
<th>Groupes</th> <th>Groupes</th>
{% if users.groups.all %} {% if users.groups.all %}
<td>{{ users.groups.all|join:", "}}</td> <td>{{ users.groups.all|join:", "}}</td>
{% else %} {% else %}
<td>Aucun</td> <td>Aucun</td>
{% endif %} {% endif %}
</tr> </tr>
<tr> <tr>
<th>Solde</th> <th>Solde</th>
<td>{{ users.solde }} € <td>{{ users.solde }} €
{% if user_solde %} {% if user_solde %}
<a class="btn btn-primary btn-sm" style='float:right' role="button" href="{% url 'cotisations:credit-solde' users.pk%}"> <a class="btn btn-primary btn-sm" style='float:right' role="button" href="{% url 'cotisations:credit-solde' users.pk%}">
<i class="fa fa-euro-sign"></i> <i class="fa fa-euro-sign"></i>
Recharger Recharger
</a> </a>
{% endif %} {% endif %}
</td> </td>
{% if users.shell %} {% if users.shell %}
<th>Shell</th> <th>Shell</th>
<td>{{ users.shell }}</td> <td>{{ users.shell }}</td>
{% endif %} {% endif %}
</tr> </tr>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
@ -193,46 +191,46 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-club-admin-members' users.club.id %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-club-admin-members' users.club.id %}">
<i class="fa fa-lock"></i> <i class="fa fa-lock"></i>
Gérer admin et membres Gérer admin et membres
</a> </a>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<h4>Administrateurs du club</h4> <h4>Administrateurs du club</h4>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>Nom</th>
<th>Prenom</th>
<th>Pseudo</th>
</tr>
</thead>
{% for admin in users.club.administrators.all %}
<tr> <tr>
<th>Nom</th> <td>{{ admin.surname }}</td>
<th>Prenom</th> <td>{{ admin.name }}</td>
<th>Pseudo</th> <td>{{ admin.pseudo }}</td>
</tr> </tr>
</thead> {% endfor %}
{% for admin in users.club.administrators.all %} </table>
<tr>
<td>{{ admin.surname }}</td>
<td>{{ admin.name }}</td>
<td>{{ admin.pseudo }}</td>
</tr>
{% endfor %}
</table>
</div> </div>
<h4>Membres</h4> <h4>Membres</h4>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>Nom</th>
<th>Prenom</th>
<th>Pseudo</th>
</tr>
</thead>
{% for admin in users.club.members.all %}
<tr> <tr>
<th>Nom</th> <td>{{ admin.surname }}</td>
<th>Prenom</th> <td>{{ admin.name }}</td>
<th>Pseudo</th> <td>{{ admin.pseudo }}</td>
</tr> </tr>
</thead> {% endfor %}
{% for admin in users.club.members.all %} </table>
<tr>
<td>{{ admin.surname }}</td>
<td>{{ admin.name }}</td>
<td>{{ admin.pseudo }}</td>
</tr>
{% endfor %}
</table>
</div> </div>
</div> </div>
</div> </div>
@ -245,12 +243,12 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
Machines Machines
<span class="badge">{{nb_machines}}</span> <span class="badge">{{nb_machines}}</span>
</h3> </h3>
</div> </div>
<div id="collapse3" class="panel-collapse collapse"> <div id="collapse3" class="panel-collapse collapse">
<div class="panel-body"> <div class="panel-body">
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-machine' users.id %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-machine' users.id %}">
<i class="fa fa-desktop"></i> <i class="fa fa-desktop"></i>
Ajouter une machine Ajouter une machine
</a> </a>
</div> </div>
<div class="panel-body"> <div class="panel-body">
@ -299,12 +297,12 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
<i class="fa fa-ban"></i> <i class="fa fa-ban"></i>
Bannissements Bannissements
</h3> </h3>
</div> </div>
<div id="collapse5" class="panel-collapse collapse"> <div id="collapse5" class="panel-collapse collapse">
<div class="panel-body"> <div class="panel-body">
{% can_create Ban %} {% can_create Ban %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-ban' users.id %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-ban' users.id %}">
<i class="fa fa-ban"></i> <i class="fa fa-ban"></i>
Ajouter un bannissement Ajouter un bannissement
</a> </a>
{% acl_end %} {% acl_end %}
@ -326,12 +324,12 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
</h3> </h3>
</div> </div>
<div id="collapse6" class="panel-collapse collapse"> <div id="collapse6" class="panel-collapse collapse">
<div class="panel-body"> <div class="panel-body">
{% can_create Whitelist %} {% can_create Whitelist %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-whitelist' users.id %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-whitelist' users.id %}">
<i class="fa fa-check-circle"></i> <i class="fa fa-check-circle"></i>
Accorder un accès à titre gracieux Accorder un accès à titre gracieux
</a> </a>
{% acl_end %} {% acl_end %}
</div> </div>
<div class="panel-body"> <div class="panel-body">

View file

@ -27,7 +27,6 @@ from __future__ import unicode_literals
from django.conf.urls import url from django.conf.urls import url
import re2o
from . import views from . import views
urlpatterns = [ urlpatterns = [
@ -95,10 +94,6 @@ urlpatterns = [
url(r'^process/(?P<token>[a-z0-9]{32})/$', views.process, name='process'), url(r'^process/(?P<token>[a-z0-9]{32})/$', views.process, name='process'),
url(r'^reset_password/$', views.reset_password, name='reset-password'), url(r'^reset_password/$', views.reset_password, name='reset-password'),
url(r'^mass_archive/$', views.mass_archive, name='mass-archive'), url(r'^mass_archive/$', views.mass_archive, name='mass-archive'),
url(r'^history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
re2o.views.history,
name='history',
kwargs={'application': 'users'}),
url(r'^$', views.index, name='index'), url(r'^$', views.index, name='index'),
url(r'^index_clubs/$', views.index_clubs, name='index-clubs'), url(r'^index_clubs/$', views.index_clubs, name='index-clubs'),
url(r'^rest/ml/std/$', url(r'^rest/ml/std/$',