8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-08-19 21:53:41 +00:00

ACL sur les templates de logs.

This commit is contained in:
LEVY-FALK Hugo 2017-12-29 11:43:09 +01:00 committed by root
parent 077215cda7
commit f842856878
4 changed files with 19 additions and 17 deletions

View file

@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endif %}
{% load logs_extra %}
{% load acl %}
<table class="table table-striped">
<thead>
@ -47,19 +48,19 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ revision.user }}</td>
<td>{{ revision.date_created }}</td>
<td>{{ revision.comment }}</td>
{% if is_bureau %}
{% can_edit_history %}
<td>
<a class="btn btn-danger btn-sm" role="button" href="{% url 'logs:revert-action' revision.id %}">
<i class="glyphicon glyphicon-remove"></i>
Annuler
</a>
</td>
{% endif %}
{% acl_end %}
</tr>
{% endfor %}
{% endfor %}
</table>
{% if revisions_list.paginator %}
{% include "pagination.html" with list=revisions_list %}
{% endif %}

View file

@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endif %}
{% load logs_extra %}
{% load acl %}
<table class="table table-striped">
<thead>
<tr>
@ -51,14 +51,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endif %}
</i>)
</td>
{% if is_bureau %}
{% can_edit_history %}
<td>
<a class="btn btn-danger btn-sm" role="button" href="{% url 'logs:revert-action' v.rev_id %}">
<i class="glyphicon glyphicon-remove"></i>
Annuler
</a>
</td>
{% endif %}
{% acl_end %}
</tr>
{% elif v.version.content_type.model == 'whitelist' %}
<tr class="success">
@ -74,14 +74,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endif %}
</i>)
</td>
{% if is_bureau %}
{% can_edit_history%}
<td>
<a class="btn btn-danger btn-sm" role="button" href="{% url 'logs:revert-action' v.rev_id %}">
<i class="glyphicon glyphicon-remove"></i>
Annuler
</a>
</td>
{% endif %}
{% acl_end %}
</tr>
{% elif v.version.content_type.model == 'user' %}
<tr>
@ -93,14 +93,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
(<i>{{ v.comment }}</i>)
{% endif %}
</td>
{% if is_bureau %}
{% can_edit_history %}
<td>
<a class="btn btn-danger btn-sm" role="button" href="{% url 'logs:revert-action' v.rev_id %}">
<i class="glyphicon glyphicon-remove"></i>
Annuler
</a>
</td>
{% endif %}
{% acl_end %}
</tr>
{% elif v.version.content_type.model == 'vente' %}
<tr>
@ -112,14 +112,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
(<i>+{{ v.version.object.duration }} mois</i>)
{% endif %}
</td>
{% if is_bureau %}
{% can_edit_history %}
<td>
<a class="btn btn-danger btn-sm" role="button" href="{% url 'logs:revert-action' v.rev_id %}">
<i class="glyphicon glyphicon-remove"></i>
Annuler
</a>
</td>
{% endif %}
{% acl_end %}
</tr>
{% elif v.version.content_type.model == 'interface' %}
<tr>
@ -131,14 +131,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
(<i>{{ v.comment }}</i>)
{% endif %}
</td>
{% if is_bureau %}
{% can_edit_history %}
<td>
<a class="btn btn-danger btn-sm" role="button" href="{% url 'logs:revert-action' v.rev_id %}">
<i class="glyphicon glyphicon-remove"></i>
Annuler
</a>
</td>
{% endif %}
{% acl_end %}
</tr>
{% endif %}
{% endfor %}

View file

@ -23,9 +23,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load acl %}
{% block sidebar %}
{% if is_cableur %}
{% can_view_app logs %}
<a class="list-group-item list-group-item-info" href="{% url "logs:index" %}">
<i class="glyphicon glyphicon-stats"></i>
Résumé
@ -50,5 +51,5 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<i class="glyphicon glyphicon-stats"></i>
Utilisateurs
</a>
{% endif %}
{% acl_end %}
{% endblock %}

View file

@ -212,7 +212,7 @@ def acl_fct(callback, reverse):
@register.tag('cannot_edit_history')
def acl_history_filter(parser, token):
"""Templatetag for acl checking on history."""
tag_name,_ = token.split_contents()
tag_name, = token.split_contents()
callback = get_callback(tag_name)
oknodes = parser.parse(('acl_else', 'acl_end'))