8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-26 14:42:25 +00:00

Fix: Forgotten legacy ldap_sync calls in machines and cotisations.

This commit is contained in:
Hugo Levy-Falk 2021-01-12 19:08:17 +01:00 committed by Gabriel Detraz
parent 724e291bd6
commit 7b941eee12
2 changed files with 11 additions and 8 deletions

View file

@ -50,6 +50,8 @@ from preferences.models import CotisationsOption
from machines.models import regen from machines.models import regen
from re2o.field_permissions import FieldPermissionModelMixin from re2o.field_permissions import FieldPermissionModelMixin
from re2o.mixins import AclMixin, RevMixin from re2o.mixins import AclMixin, RevMixin
import users.signals
import users.models
from cotisations.utils import find_payment_method, send_mail_invoice, send_mail_voucher from cotisations.utils import find_payment_method, send_mail_invoice, send_mail_voucher
from cotisations.validators import check_no_balance from cotisations.validators import check_no_balance
@ -356,7 +358,7 @@ def facture_post_save(**kwargs):
if facture.valid: if facture.valid:
user = facture.user user = facture.user
user.set_active() user.set_active()
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False) users.signals.synchronise.send(sender=users.models.User, instance=user, base=False, access_refresh=True, mac_refresh=False)
@receiver(post_delete, sender=Facture) @receiver(post_delete, sender=Facture)
@ -365,7 +367,7 @@ def facture_post_delete(**kwargs):
Synchronise the LDAP user after an invoice has been deleted. Synchronise the LDAP user after an invoice has been deleted.
""" """
user = kwargs["instance"].user user = kwargs["instance"].user
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False) users.signals.synchronise.send(sender=users.models.User, instance=user, base=False, access_refresh=True, mac_refresh=False)
class CustomInvoice(BaseInvoice): class CustomInvoice(BaseInvoice):
@ -661,7 +663,7 @@ def vente_post_save(**kwargs):
purchase.cotisation.save() purchase.cotisation.save()
user = purchase.facture.facture.user user = purchase.facture.facture.user
user.set_active() user.set_active()
user.ldap_sync(base=True, access_refresh=True, mac_refresh=False) users.signals.synchronise.send(sender=users.models.User, instance=user, base=True, access_refresh=True, mac_refresh=False)
# TODO : change vente to purchase # TODO : change vente to purchase
@ -677,7 +679,7 @@ def vente_post_delete(**kwargs):
return return
if purchase.type_cotisation: if purchase.type_cotisation:
user = invoice.user user = invoice.user
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False) users.signals.synchronise.send(sender=users.models.User, instance=user, base=True, access_refresh=True, mac_refresh=False)
class Article(RevMixin, AclMixin, models.Model): class Article(RevMixin, AclMixin, models.Model):

View file

@ -58,6 +58,7 @@ from netaddr import (
import preferences.models import preferences.models
import users.models import users.models
import users.signals
from re2o.field_permissions import FieldPermissionModelMixin from re2o.field_permissions import FieldPermissionModelMixin
from re2o.mixins import AclMixin, RevMixin from re2o.mixins import AclMixin, RevMixin
@ -2541,7 +2542,7 @@ class OuverturePort(RevMixin, AclMixin, models.Model):
def machine_post_save(**kwargs): def machine_post_save(**kwargs):
"""Synchronise LDAP and regen firewall/DHCP after a machine is edited.""" """Synchronise LDAP and regen firewall/DHCP after a machine is edited."""
user = kwargs["instance"].user user = kwargs["instance"].user
user.ldap_sync(base=False, access_refresh=False, mac_refresh=True) users.signals.synchronise.send(sender=users.models.User, instance=user, base=False, access_refresh=False, mac_refresh=True)
regen("dhcp") regen("dhcp")
regen("mac_ip_list") regen("mac_ip_list")
@ -2551,7 +2552,7 @@ def machine_post_delete(**kwargs):
"""Synchronise LDAP and regen firewall/DHCP after a machine is deleted.""" """Synchronise LDAP and regen firewall/DHCP after a machine is deleted."""
machine = kwargs["instance"] machine = kwargs["instance"]
user = machine.user user = machine.user
user.ldap_sync(base=False, access_refresh=False, mac_refresh=True) users.signals.synchronise.send(sender=users.models.User, instance=user, base=False, access_refresh=False, mac_refresh=True)
regen("dhcp") regen("dhcp")
regen("mac_ip_list") regen("mac_ip_list")
@ -2564,7 +2565,7 @@ def interface_post_save(**kwargs):
interface = kwargs["instance"] interface = kwargs["instance"]
interface.sync_ipv6() interface.sync_ipv6()
user = interface.machine.user user = interface.machine.user
user.ldap_sync(base=False, access_refresh=False, mac_refresh=True) users.signals.synchronise.send(sender=users.models.User, instance=user, base=False, access_refresh=False, mac_refresh=True)
# Regen services # Regen services
regen("dhcp") regen("dhcp")
regen("mac_ip_list") regen("mac_ip_list")
@ -2580,7 +2581,7 @@ def interface_post_delete(**kwargs):
""" """
interface = kwargs["instance"] interface = kwargs["instance"]
user = interface.machine.user user = interface.machine.user
user.ldap_sync(base=False, access_refresh=False, mac_refresh=True) users.signals.synchronise.send(sender=users.models.User, instance=user, base=False, access_refresh=False, mac_refresh=True)
@receiver(post_save, sender=IpType) @receiver(post_save, sender=IpType)