mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-27 15:12:25 +00:00
Affichage des boutons admin sur profil uniquement si droit
This commit is contained in:
parent
6257c4d4bb
commit
f9b3ac03bb
2 changed files with 5 additions and 1 deletions
|
@ -78,7 +78,7 @@ def can_edit(model, *field_list):
|
||||||
kwargs={'userid':str(request.user.id)}
|
kwargs={'userid':str(request.user.id)}
|
||||||
))
|
))
|
||||||
for field in field_list:
|
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)
|
can, msg = can_change(request.user, *args, **kwargs)
|
||||||
if not can:
|
if not can:
|
||||||
messages.error(request, msg or "Vous ne pouvez pas accéder à ce menu")
|
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>
|
<i class="glyphicon glyphicon-lock"></i>
|
||||||
Changer le mot de passe
|
Changer le mot de passe
|
||||||
</a>
|
</a>
|
||||||
|
{% can_change User state %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' users.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' users.id %}">
|
||||||
<i class="glyphicon glyphicon-flash"></i>
|
<i class="glyphicon glyphicon-flash"></i>
|
||||||
Changer le statut
|
Changer le statut
|
||||||
</a>
|
</a>
|
||||||
|
{% acl_end %}
|
||||||
|
{% can_change User groups %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:groups' users.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:groups' users.id %}">
|
||||||
<i class="glyphicon glyphicon-ok"></i>
|
<i class="glyphicon glyphicon-ok"></i>
|
||||||
Gérer les groupes
|
Gérer les groupes
|
||||||
</a>
|
</a>
|
||||||
|
{% acl_end %}
|
||||||
<a class="btn btn-info btn-sm" role="button" href="{% url 'users:history' 'user' users.id %}">
|
<a class="btn btn-info btn-sm" role="button" href="{% url 'users:history' 'user' users.id %}">
|
||||||
<i class="glyphicon glyphicon-time"></i>
|
<i class="glyphicon glyphicon-time"></i>
|
||||||
Historique
|
Historique
|
||||||
|
|
Loading…
Reference in a new issue