diff --git a/cotisations/models.py b/cotisations/models.py index e3b7aece..4e83b075 100644 --- a/cotisations/models.py +++ b/cotisations/models.py @@ -149,10 +149,10 @@ class Facture(FieldPermissionModelMixin, models.Model): else: return True, None - def can_change_control(self, user, *args, **kwargs): + def can_change_control(user, *args, **kwargs): return user.has_perms(('tresorier',)), "Vous ne pouvez pas éditer le controle sans droit trésorier" - def can_change_pdf(self, user, *args, **kwargs): + def can_change_pdf(user, *args, **kwargs): return user.has_perms(('tresorier',)), "Vous ne pouvez pas éditer une facture sans droit trésorier" field_permissions = { diff --git a/cotisations/templates/cotisations/sidebar.html b/cotisations/templates/cotisations/sidebar.html index c7293810..3506e5e8 100644 --- a/cotisations/templates/cotisations/sidebar.html +++ b/cotisations/templates/cotisations/sidebar.html @@ -26,16 +26,16 @@ with this program; if not, write to the Free Software Foundation, Inc., {% load acl %} {% block sidebar %} - {% can_create Facture %} + {% can_change Facture pdf %} Créer une facture - {% acl_end %} Contrôler les factures + {% acl_end %} {% can_view_all Facture %} diff --git a/re2o/field_permissions.py b/re2o/field_permissions.py index 5614582c..184778af 100644 --- a/re2o/field_permissions.py +++ b/re2o/field_permissions.py @@ -17,9 +17,6 @@ class FieldPermissionModelMixin: checks = self.field_permissions[field] if not isinstance(checks, (list, tuple)): checks = [checks] - for i, perm in enumerate(checks): - if callable(perm): - checks[i] = partial(perm, field=field) else: checks = [] @@ -45,7 +42,7 @@ class FieldPermissionModelMixin: # Try to find a user setting that qualifies them for permission. for perm in checks: if callable(perm): - result, reason = perm(self, user=user) + result, reason = perm(user=user) if result is not None: return result else: diff --git a/users/models.py b/users/models.py index 62c954b8..6bdca96c 100644 --- a/users/models.py +++ b/users/models.py @@ -820,13 +820,13 @@ class User(FieldPermissionModelMixin, AbstractBaseUser): else: return False, u"Vous ne pouvez éditer un autre utilisateur que vous même" - def can_change_state(self, user_request, *args, **kwargs): + def can_change_state(user_request, *args, **kwargs): return user_request.has_perms(('bureau',)), "Droit bureau requis pour changer l'état" - def can_change_shell(self, user_request, *args, **kwargs): - return user_request.has_perms(('cableur',)), "Droit requis pour forcer le déménagement" + def can_change_shell(user_request, *args, **kwargs): + return user_request.has_perms(('cableur',)), "Droit requis pour changer le shell" - def can_change_force(self, user_request, *args, **kwargs): + def can_change_force(user_request, *args, **kwargs): return user_request.has_perms(('cableur',)), "Droit requis pour forcer le déménagement" def can_delete(self, user_request, *args, **kwargs): diff --git a/users/templates/users/sidebar.html b/users/templates/users/sidebar.html index 08e700d6..74e8e020 100644 --- a/users/templates/users/sidebar.html +++ b/users/templates/users/sidebar.html @@ -81,8 +81,10 @@ with this program; if not, write to the Free Software Foundation, Inc., Retirer un droit + {% can_change User state %} Archiver en masse + {% acl_end %} {% endblock %}