8
0
Fork 0
mirror of https://gitlab.federez.net/re2o/re2o synced 2024-05-16 23:56:12 +00:00
re2o/users/templates/users/aff_listright.html

212 lines
9.5 KiB
HTML

{% comment %}
Re2o est un logiciel d'administration développé initiallement au Rézo Metz. Il
se veut agnostique au réseau considéré, de manière à être installable en
quelques clics.
Copyright © 2017 Gabriel Détraz
Copyright © 2017 Lara 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 i18n %}
{% load logs_extra %}
{% if superusers.count %}
<div class="panel panel-default">
<div class="panel-heading clearfix" data-toggle="collapse" data-target="#collapse_superuser">
<div class="pull-right">
<a type="button" class="btn btn-sm btn-default" data-toggle="modal" data-target="#modal_superuser">
{{ superusers.count }} <i class="fa fa-user"></i>
</a>
</div>
<h4 class="text-danger">
<i class="fa fa-address-book"></i>
{% trans "Superuser" %}
</h4>
{% trans "Django's specific pre-defined right that supersedes any other rights." %}
</div>
<div class="panel-collapse collapse" id="collapse_superuser">
<div class="panel-body">
<h4 class="text-danger">{% trans "Total: all permissions" %}</h4>
</div>
</div>
</div>
<div class="modal fade" id="modal_superuser" tabindex="-1" role="dialog" aria-labelledby={% trans "Users in Superuser" %}>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label={% trans "Close" %}>
<i class="fa fa-times"></i>
</button>
<h4 class="modal-title" id="myModalLabel">{% trans "Users in Superuser" %}</h4>
</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>
{% if user.end_adhesion is not None and user.end_adhesion >= now_aware %}
<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">
{% blocktrans trimmed with user.end_adhesion as end_date %}
Not since {{ end_date }}
{% endblocktrans %}
</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 %}
<td class="text-success">{{ user.last_seen }}</td>
{% 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>
</div>
</div>
</div>
</div>
</div>
{% endif %}
{% for right, users in rights.items %}
<div class="panel panel-default">
<div class="panel-heading clearfix" data-toggle="collapse" data-target="#collapse_{{right.id}}">
<div class="pull-right">
{% if users %}
<a type="button" class="btn btn-sm btn-default" data-toggle="modal" data-target="#modal_{{right.id}}">
{% else %}
<a type="button" class="btn btn-sm btn-default" disabled="disabled">
{% endif %}
{{users.count}} <i class="fa fa-user"></i>
</a>
{% include 'buttons/edit.html' with href='users:edit-listright' id=right.id %}
{% 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 }}
</div>
<div class="panel-collapse collapse" id="collapse_{{right.id}}">
<div class="panel-body">
<h4>
{% blocktrans trimmed count right.permissions.count as perm_count%}
Total: {{ perm_count }} permission
{% plural %}
Total: {{ perm_count }} permissions
{% endblocktrans %}
</h4>
<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>
{% if users %}
<div class="modal fade" id="modal_{{right.id}}" tabindex="-1" role="dialog" aria-labelledby={% trans "Users" %}>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label={% trans "Close" %}>
<i class="fa fa-times"></i>
</button>
<h4 class="modal-title" id="myModalLabel">
{% blocktrans trimmed with right.name as right_name %}
Users in {{ right_name }}
{% endblocktrans %}
</h4>
</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>
{% if user.end_adhesion is not None and user.end_adhesion >= now_aware %}
<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">
{% blocktrans trimmed with user.end_adhesion as end_date %}
Not since {{ end_date }}
{% endblocktrans %}
</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 %}
<td class="text-success">{{ user.last_seen }}</td>
{% 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 %}