2017-01-15 23:07:42 +00:00
|
|
|
{% 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
|
2019-09-29 14:02:28 +00:00
|
|
|
Copyright © 2017 Lara Kermarec
|
2017-01-15 23:07:42 +00:00
|
|
|
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 %}
|
|
|
|
|
2018-06-27 19:37:13 +00:00
|
|
|
{% load i18n %}
|
2018-07-19 10:30:15 +00:00
|
|
|
{% load logs_extra %}
|
2018-06-27 19:37:13 +00:00
|
|
|
|
|
|
|
{% if superusers.count %}
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading clearfix" data-toggle="collapse" data-target="#collapse_superuser">
|
2018-07-19 10:30:15 +00:00
|
|
|
<div class="pull-right">
|
|
|
|
<a type="button" class="btn btn-sm btn-default" data-toggle="modal" data-target="#modal_superuser">
|
2019-01-08 23:40:59 +00:00
|
|
|
{{ superusers.count }} <i class="fa fa-user"></i>
|
2018-07-19 10:30:15 +00:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<h4 class="text-danger">
|
|
|
|
<i class="fa fa-address-book"></i>
|
|
|
|
{% trans "Superuser" %}
|
|
|
|
</h4>
|
2019-11-20 00:52:11 +00:00
|
|
|
{% trans "Django's specific pre-defined right that supersedes any other rights." %}
|
2018-06-27 19:37:13 +00:00
|
|
|
</div>
|
|
|
|
<div class="panel-collapse collapse" id="collapse_superuser">
|
|
|
|
<div class="panel-body">
|
2019-01-08 23:40:59 +00:00
|
|
|
<h4 class="text-danger">{% trans "Total: all permissions" %}</h4>
|
2018-06-27 19:37:13 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2019-01-08 23:40:59 +00:00
|
|
|
<div class="modal fade" id="modal_superuser" tabindex="-1" role="dialog" aria-labelledby={% trans "Users in Superuser" %}>
|
2018-06-27 19:37:13 +00:00
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
2019-01-08 23:40:59 +00:00
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label={% trans "Close" %}>
|
2018-06-27 19:37:13 +00:00
|
|
|
<i class="fa fa-times"></i>
|
2018-04-16 22:32:37 +00:00
|
|
|
</button>
|
2018-06-27 22:08:28 +00:00
|
|
|
<h4 class="modal-title" id="myModalLabel">{% trans "Users in Superuser" %}</h4>
|
2018-06-27 19:37:13 +00:00
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<div class="table-responsive">
|
|
|
|
<table class="table table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>{% trans "Username" %}</th>
|
|
|
|
<th>{% trans "Membership" %}</th>
|
|
|
|
<th>{% trans "Last seen" %}</th>
|
|
|
|
<th>{% trans "Actions" %}</th>
|
|
|
|
<th>{% trans "Last action" %}</th>
|
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
{% for user in superusers %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ user.pseudo }}</td>
|
2018-07-12 12:19:26 +00:00
|
|
|
{% if user.end_adhesion is not None and user.end_adhesion >= now_aware %}
|
2018-06-27 19:37:13 +00:00
|
|
|
<td class="text-success">{% trans "Member" %}</td>
|
|
|
|
{% elif not user.end_adhesion %}
|
|
|
|
<td class="text-warning">{% trans "No membership records" %}</td>
|
|
|
|
{% else %}
|
|
|
|
<td class="text-danger">
|
2018-06-27 22:08:28 +00:00
|
|
|
{% blocktrans trimmed with user.end_adhesion as end_date %}
|
|
|
|
Not since {{ end_date }}
|
|
|
|
{% endblocktrans %}
|
2018-06-27 19:37:13 +00:00
|
|
|
</td>
|
|
|
|
{% endif %}
|
|
|
|
<td>{{ user.last_login }}</td>
|
|
|
|
<td>{{ user.action_number }}</td>
|
|
|
|
{% if not user.last_seen %}
|
|
|
|
<td class="text-danger">{% trans "Never" %}</td>
|
|
|
|
{% else %}
|
2018-06-27 22:08:28 +00:00
|
|
|
<td class="text-success">{{ user.last_seen }}</td>
|
2018-06-27 19:37:13 +00:00
|
|
|
{% endif %}
|
|
|
|
<td>
|
|
|
|
<a class="btn btn-danger" role="button" href="{% url 'users:del-superuser' user.id %}">
|
|
|
|
<span class="fa fa-user-times" aria-hidden="true"></span>
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</table>
|
2018-04-16 22:32:37 +00:00
|
|
|
</div>
|
2018-06-27 19:37:13 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2018-04-16 22:32:37 +00:00
|
|
|
|
2018-06-27 19:37:13 +00:00
|
|
|
{% for right, users in rights.items %}
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading clearfix" data-toggle="collapse" data-target="#collapse_{{right.id}}">
|
2018-07-19 10:30:15 +00:00
|
|
|
<div class="pull-right">
|
|
|
|
{% if users %}
|
|
|
|
<a type="button" class="btn btn-sm btn-default" data-toggle="modal" data-target="#modal_{{right.id}}">
|
2018-06-27 19:37:13 +00:00
|
|
|
{% else %}
|
2018-06-27 21:17:29 +00:00
|
|
|
<a type="button" class="btn btn-sm btn-default" disabled="disabled">
|
2018-07-19 10:30:15 +00:00
|
|
|
{% endif %}
|
2018-06-27 21:17:29 +00:00
|
|
|
{{users.count}} <i class="fa fa-user"></i>
|
|
|
|
</a>
|
2018-06-27 19:37:13 +00:00
|
|
|
{% include 'buttons/edit.html' with href='users:edit-listright' id=right.id %}
|
2018-07-19 10:30:15 +00:00
|
|
|
{% history_button right %}
|
|
|
|
</div>
|
|
|
|
<h4 class="{% if right.critical %}text-danger{% endif %}">
|
|
|
|
<i class="fa fa-address-book"></i>
|
|
|
|
{% blocktrans trimmed with right.name as right_name and right.gid as right_gid %}
|
|
|
|
{{ right_name }} (gid: {{ right_gid }})
|
|
|
|
{% endblocktrans %}
|
|
|
|
</h4>
|
|
|
|
{{ right.details }}
|
2018-06-27 19:37:13 +00:00
|
|
|
</div>
|
|
|
|
<div class="panel-collapse collapse" id="collapse_{{right.id}}">
|
|
|
|
<div class="panel-body">
|
2018-06-27 22:08:28 +00:00
|
|
|
<h4>
|
|
|
|
{% blocktrans trimmed count right.permissions.count as perm_count%}
|
|
|
|
Total: {{ perm_count }} permission
|
|
|
|
{% plural %}
|
|
|
|
Total: {{ perm_count }} permissions
|
|
|
|
{% endblocktrans %}
|
|
|
|
</h4>
|
2018-06-27 19:37:13 +00:00
|
|
|
<ul class="list-group" style="margin-bottom: 0px">
|
|
|
|
{% for perm in right.permissions.all %}
|
|
|
|
<li class="list-group-item col-xs-6 col-sm-4 col-md-3" style="border:none;">
|
|
|
|
{{perm.name}}
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-07-26 00:54:32 +00:00
|
|
|
|
2018-06-27 19:37:13 +00:00
|
|
|
{% if users %}
|
2019-01-08 23:40:59 +00:00
|
|
|
<div class="modal fade" id="modal_{{right.id}}" tabindex="-1" role="dialog" aria-labelledby={% trans "Users" %}>
|
2018-06-27 19:37:13 +00:00
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
2019-01-08 23:40:59 +00:00
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label={% trans "Close" %}>
|
2018-06-27 19:37:13 +00:00
|
|
|
<i class="fa fa-times"></i>
|
|
|
|
</button>
|
2018-06-27 22:08:28 +00:00
|
|
|
<h4 class="modal-title" id="myModalLabel">
|
|
|
|
{% blocktrans trimmed with right.name as right_name %}
|
|
|
|
Users in {{ right_name }}
|
|
|
|
{% endblocktrans %}
|
|
|
|
</h4>
|
2018-06-27 19:37:13 +00:00
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<div class="table-responsive">
|
|
|
|
<table class="table table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>{% trans "Username" %}</th>
|
|
|
|
<th>{% trans "Membership" %}</th>
|
|
|
|
<th>{% trans "Last seen" %}</th>
|
|
|
|
<th>{% trans "Actions" %}</th>
|
|
|
|
<th>{% trans "Last action" %}</th>
|
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
{% for user in users %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ user.pseudo }}</td>
|
2018-07-12 12:19:26 +00:00
|
|
|
{% if user.end_adhesion is not None and user.end_adhesion >= now_aware %}
|
2018-06-27 19:37:13 +00:00
|
|
|
<td class="text-success">{% trans "Member" %}</td>
|
|
|
|
{% elif not user.end_adhesion %}
|
|
|
|
<td class="text-warning">{% trans "No membership records" %}</td>
|
|
|
|
{% else %}
|
|
|
|
<td class="text-danger">
|
2018-06-27 22:08:28 +00:00
|
|
|
{% blocktrans trimmed with user.end_adhesion as end_date %}
|
|
|
|
Not since {{ end_date }}
|
|
|
|
{% endblocktrans %}
|
2018-06-27 19:37:13 +00:00
|
|
|
</td>
|
|
|
|
{% endif %}
|
|
|
|
<td>{{ user.last_login }}</td>
|
|
|
|
<td>{{ user.action_number }}</td>
|
|
|
|
{% if not user.last_seen %}
|
|
|
|
<td class="text-danger">{% trans "Never" %}</td>
|
|
|
|
{% else %}
|
2019-01-08 23:40:59 +00:00
|
|
|
<td class="text-success">{{ user.last_seen }}</td>
|
2018-06-27 19:37:13 +00:00
|
|
|
{% endif %}
|
|
|
|
<td>
|
|
|
|
<a class="btn btn-danger" role="button" href="{% url 'users:del-group' user.id right.id %}">
|
|
|
|
<span class="fa fa-user-times" aria-hidden="true"></span>
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|