Commit f9b3ac03 authored by Gabriel Detraz's avatar Gabriel Detraz Committed by root

Affichage des boutons admin sur profil uniquement si droit

parent 6257c4d4
......@@ -78,7 +78,7 @@ def can_edit(model, *field_list):
kwargs={'userid':str(request.user.id)}
))
for field in field_list:
can_change = getattr(model, 'can_change_' + field)
can_change = getattr(instance, 'can_change_' + field)
can, msg = can_change(request.user, *args, **kwargs)
if not can:
messages.error(request, msg or "Vous ne pouvez pas accéder à ce menu")
......
......@@ -38,14 +38,18 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<i class="glyphicon glyphicon-lock"></i>
Changer le mot de passe
</a>
{% can_change User state %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' users.id %}">
<i class="glyphicon glyphicon-flash"></i>
Changer le statut
</a>
{% acl_end %}
{% can_change User groups %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:groups' users.id %}">
<i class="glyphicon glyphicon-ok"></i>
Gérer les groupes
</a>
{% acl_end %}
<a class="btn btn-info btn-sm" role="button" href="{% url 'users:history' 'user' users.id %}">
<i class="glyphicon glyphicon-time"></i>
Historique
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment