From f9b3ac03bbdd97fc0b4a436b9028029a6349fb38 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Thu, 4 Jan 2018 14:55:03 +0100 Subject: [PATCH] Affichage des boutons admin sur profil uniquement si droit --- re2o/acl.py | 2 +- users/templates/users/profil.html | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/re2o/acl.py b/re2o/acl.py index bea27251..ffbbea42 100644 --- a/re2o/acl.py +++ b/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") diff --git a/users/templates/users/profil.html b/users/templates/users/profil.html index 27d699ac..acbec931 100644 --- a/users/templates/users/profil.html +++ b/users/templates/users/profil.html @@ -38,14 +38,18 @@ with this program; if not, write to the Free Software Foundation, Inc., Changer le mot de passe + {% can_change User state %} Changer le statut + {% acl_end %} + {% can_change User groups %} Gérer les groupes + {% acl_end %} Historique