Browse Source

Affichage des boutons admin sur profil uniquement si droit

test-front-curly
Gabriel Detraz 8 years ago
committed by root
parent
commit
f9b3ac03bb
  1. 2
      re2o/acl.py
  2. 4
      users/templates/users/profil.html

2
re2o/acl.py

@ -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")

4
users/templates/users/profil.html

@ -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

Loading…
Cancel
Save