From 53dc43f58627692abe945067119cb1d072027f0d Mon Sep 17 00:00:00 2001 From: grisel-davy Date: Sat, 24 Mar 2018 00:51:54 +0100 Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20de=20la=20page=20d'administrati?= =?UTF-8?q?on=20des=20droits=20des=20users?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logs/templates/logs/aff_stats_droits.html | 110 ++++++++++++++++++++++ logs/templates/logs/sidebar.html | 4 + logs/templates/logs/stats_droits.html | 36 +++++++ logs/urls.py | 1 + logs/views.py | 7 ++ 5 files changed, 158 insertions(+) create mode 100644 logs/templates/logs/aff_stats_droits.html create mode 100644 logs/templates/logs/stats_droits.html diff --git a/logs/templates/logs/aff_stats_droits.html b/logs/templates/logs/aff_stats_droits.html new file mode 100644 index 00000000..dcd7a4db --- /dev/null +++ b/logs/templates/logs/aff_stats_droits.html @@ -0,0 +1,110 @@ +{% comment %} +Re2o est un logiciel d'administration développé initiallement au rezometz. Il +se veut agnostique au réseau considéré, de manière à être installable en +quelques clics. + +Copyright © 2017 Gabriel Détraz +Copyright © 2017 Goulven Kermarec +Copyright © 2017 Augustin Lemesle + +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 +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +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., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +{% endcomment %} + +{% load bootstrap3 %} +{% load acl %} + +
+ {% for droit in stats_list %} +
+
+

+ + {{droit}} + {{droit.user_set.all.count}} +

+ +
+
+
+ +
+ + + + + + + + + + + {% for user in droit.user_set.all %} + + + {% if user.is_adherent %} + + {% elif not user.end_adhesion %} + + {% else %} + + {% endif %} + + + + {% endfor %} + +
PseudoAdhésionDerniere connectionNombre d'actionsSupprimer
{{ user.pseudo }}

Adhérent

On ne s'en souvient plus...

Plus depuis {{ user.end_adhesion }}

{{ user.last_login }}{{ user.name }}
+
+ + + +
+
+
+ {% endfor %} +
diff --git a/logs/templates/logs/sidebar.html b/logs/templates/logs/sidebar.html index 0e3048e3..03a4bd73 100644 --- a/logs/templates/logs/sidebar.html +++ b/logs/templates/logs/sidebar.html @@ -51,5 +51,9 @@ with this program; if not, write to the Free Software Foundation, Inc., Utilisateurs + + + Groupes de droit + {% acl_end %} {% endblock %} diff --git a/logs/templates/logs/stats_droits.html b/logs/templates/logs/stats_droits.html new file mode 100644 index 00000000..76c20331 --- /dev/null +++ b/logs/templates/logs/stats_droits.html @@ -0,0 +1,36 @@ +{% extends "logs/sidebar.html" %} +{% comment %} +Re2o est un logiciel d'administration développé initiallement au rezometz. Il +se veut agnostique au réseau considéré, de manière à être installable en +quelques clics. + +Copyright © 2017 Gabriel Détraz +Copyright © 2017 Goulven Kermarec +Copyright © 2017 Augustin Lemesle + +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 +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +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., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +{% endcomment %} + +{% load bootstrap3 %} + +{% block title %}Statistiques des droits{% endblock %} + +{% block content %} +

Statistiques des droits

+ {% include "logs/aff_stats_droits.html" with stats_list=stats_list %} +
+
+
+ {% endblock %} diff --git a/logs/urls.py b/logs/urls.py index 11009835..98dec281 100644 --- a/logs/urls.py +++ b/logs/urls.py @@ -39,4 +39,5 @@ urlpatterns = [ url(r'^stats_models/$', views.stats_models, name='stats-models'), url(r'^stats_users/$', views.stats_users, name='stats-users'), url(r'^stats_actions/$', views.stats_actions, name='stats-actions'), + url(r'^stats_droits/$', views.stats_droits, name='stats-droits'), ] diff --git a/logs/views.py b/logs/views.py index 48e52fe0..5b117f2f 100644 --- a/logs/views.py +++ b/logs/views.py @@ -446,3 +446,10 @@ def stats_actions(request): }, } return render(request, 'logs/stats_users.html', {'stats_list': stats}) + +@login_required +@can_view_app('users') +def stats_droits(request): + """Affiche la liste des droits disponibles""" + droits=ListRight.objects.all().prefetch_related('user_set') + return render(request, 'logs/stats_droits.html', {'stats_list': droits})