8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-05 01:16:27 +00:00

Activation de la synchro ldap users

This commit is contained in:
Gabriel Detraz 2016-11-20 16:53:59 +01:00 committed by Simon Brélivet
parent 3604491582
commit 167a9ba9f9
3 changed files with 33 additions and 12 deletions

View file

@ -34,12 +34,12 @@ class Facture(models.Model):
def facture_post_save(sender, **kwargs):
facture = kwargs['instance']
user = facture.user
#user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
@receiver(post_delete, sender=Facture)
def facture_post_delete(sender, **kwargs):
user = kwargs['instance'].user
#user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
class Vente(models.Model):
PRETTY_NAME = "Ventes effectuées"
@ -68,14 +68,14 @@ def vente_post_save(sender, **kwargs):
vente = kwargs['instance']
if vente.iscotisation:
user = vente.facture.user
#user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
@receiver(post_delete, sender=Vente)
def vente_post_delete(sender, **kwargs):
vente = kwargs['instance']
if vente.iscotisation:
user = vente.facture.user
#user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
class Article(models.Model):
PRETTY_NAME = "Articles en vente"

View file

@ -129,9 +129,9 @@ class IpList(models.Model):
@receiver(post_save, sender=Interface)
def interface_post_save(sender, **kwargs):
user = kwargs['instance'].machine.user
#user.ldap_sync(base=False, access_refresh=False, mac_refresh=True)
user.ldap_sync(base=False, access_refresh=False, mac_refresh=True)
@receiver(post_delete, sender=Interface)
def interface_post_delete(sender, **kwargs):
user = kwargs['instance'].machine.user
#user.ldap_sync(base=False, access_refresh=False, mac_refresh=True)
user.ldap_sync(base=False, access_refresh=False, mac_refresh=True)

View file

@ -257,7 +257,7 @@ class User(AbstractBaseUser):
user_ldap.mail = self.email
user_ldap.given_name = str(self.surname).lower() + '_' + str(self.name).lower()[:3]
user_ldap.gid = LDAP['user_gid']
user_ldap.user_password = self.password
user_ldap.user_password = self.password[:6] + self.password[7:]
user_ldap.sambat_nt_password = self.pwd_ntlm
if self.shell:
user_ldap.login_shell = self.shell.shell
@ -277,15 +277,15 @@ class User(AbstractBaseUser):
def __str__(self):
return self.pseudo
#@receiver(post_save, sender=User)
#def user_post_save(sender, **kwargs):
# user = kwargs['instance']
#user.ldap_sync(base=True, access_refresh=True, mac_refresh=False)
@receiver(post_save, sender=User)
def user_post_save(sender, **kwargs):
user = kwargs['instance']
user.ldap_sync(base=True, access_refresh=True, mac_refresh=False)
@receiver(post_delete, sender=User)
def user_post_delete(sender, **kwargs):
user = kwargs['instance']
#user.ldap_del()
user.ldap_del()
class ServiceUser(AbstractBaseUser):
PRETTY_NAME = "Utilisateurs de service"
@ -409,6 +409,16 @@ class Ban(models.Model):
def __str__(self):
return str(self.user) + ' ' + str(self.raison)
@receiver(post_save, sender=Ban)
def ban_post_save(sender, **kwargs):
ban = kwargs['instance']
user = ban.user
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
@receiver(post_delete, sender=Ban)
def ban_post_delete(sender, **kwargs):
user = kwargs['instance'].user
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
class Whitelist(models.Model):
PRETTY_NAME = "Liste des accès gracieux"
@ -421,6 +431,17 @@ class Whitelist(models.Model):
def __str__(self):
return str(self.user) + ' ' + str(self.raison)
@receiver(post_save, sender=Whitelist)
def whitelist_post_save(sender, **kwargs):
whitelist = kwargs['instance']
user = whitelist.user
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
@receiver(post_delete, sender=Whitelist)
def whitelist_post_delete(sender, **kwargs):
user = kwargs['instance'].user
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
class Request(models.Model):
PASSWD = 'PW'
EMAIL = 'EM'