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:
parent
3604491582
commit
167a9ba9f9
3 changed files with 33 additions and 12 deletions
|
@ -34,12 +34,12 @@ class Facture(models.Model):
|
||||||
def facture_post_save(sender, **kwargs):
|
def facture_post_save(sender, **kwargs):
|
||||||
facture = kwargs['instance']
|
facture = kwargs['instance']
|
||||||
user = facture.user
|
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)
|
@receiver(post_delete, sender=Facture)
|
||||||
def facture_post_delete(sender, **kwargs):
|
def facture_post_delete(sender, **kwargs):
|
||||||
user = kwargs['instance'].user
|
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):
|
class Vente(models.Model):
|
||||||
PRETTY_NAME = "Ventes effectuées"
|
PRETTY_NAME = "Ventes effectuées"
|
||||||
|
@ -68,14 +68,14 @@ def vente_post_save(sender, **kwargs):
|
||||||
vente = kwargs['instance']
|
vente = kwargs['instance']
|
||||||
if vente.iscotisation:
|
if vente.iscotisation:
|
||||||
user = vente.facture.user
|
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)
|
@receiver(post_delete, sender=Vente)
|
||||||
def vente_post_delete(sender, **kwargs):
|
def vente_post_delete(sender, **kwargs):
|
||||||
vente = kwargs['instance']
|
vente = kwargs['instance']
|
||||||
if vente.iscotisation:
|
if vente.iscotisation:
|
||||||
user = vente.facture.user
|
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):
|
class Article(models.Model):
|
||||||
PRETTY_NAME = "Articles en vente"
|
PRETTY_NAME = "Articles en vente"
|
||||||
|
|
|
@ -129,9 +129,9 @@ class IpList(models.Model):
|
||||||
@receiver(post_save, sender=Interface)
|
@receiver(post_save, sender=Interface)
|
||||||
def interface_post_save(sender, **kwargs):
|
def interface_post_save(sender, **kwargs):
|
||||||
user = kwargs['instance'].machine.user
|
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)
|
@receiver(post_delete, sender=Interface)
|
||||||
def interface_post_delete(sender, **kwargs):
|
def interface_post_delete(sender, **kwargs):
|
||||||
user = kwargs['instance'].machine.user
|
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)
|
||||||
|
|
|
@ -257,7 +257,7 @@ class User(AbstractBaseUser):
|
||||||
user_ldap.mail = self.email
|
user_ldap.mail = self.email
|
||||||
user_ldap.given_name = str(self.surname).lower() + '_' + str(self.name).lower()[:3]
|
user_ldap.given_name = str(self.surname).lower() + '_' + str(self.name).lower()[:3]
|
||||||
user_ldap.gid = LDAP['user_gid']
|
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
|
user_ldap.sambat_nt_password = self.pwd_ntlm
|
||||||
if self.shell:
|
if self.shell:
|
||||||
user_ldap.login_shell = self.shell.shell
|
user_ldap.login_shell = self.shell.shell
|
||||||
|
@ -277,15 +277,15 @@ class User(AbstractBaseUser):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.pseudo
|
return self.pseudo
|
||||||
|
|
||||||
#@receiver(post_save, sender=User)
|
@receiver(post_save, sender=User)
|
||||||
#def user_post_save(sender, **kwargs):
|
def user_post_save(sender, **kwargs):
|
||||||
# user = kwargs['instance']
|
user = kwargs['instance']
|
||||||
#user.ldap_sync(base=True, access_refresh=True, mac_refresh=False)
|
user.ldap_sync(base=True, access_refresh=True, mac_refresh=False)
|
||||||
|
|
||||||
@receiver(post_delete, sender=User)
|
@receiver(post_delete, sender=User)
|
||||||
def user_post_delete(sender, **kwargs):
|
def user_post_delete(sender, **kwargs):
|
||||||
user = kwargs['instance']
|
user = kwargs['instance']
|
||||||
#user.ldap_del()
|
user.ldap_del()
|
||||||
|
|
||||||
class ServiceUser(AbstractBaseUser):
|
class ServiceUser(AbstractBaseUser):
|
||||||
PRETTY_NAME = "Utilisateurs de service"
|
PRETTY_NAME = "Utilisateurs de service"
|
||||||
|
@ -409,6 +409,16 @@ class Ban(models.Model):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.user) + ' ' + str(self.raison)
|
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):
|
class Whitelist(models.Model):
|
||||||
PRETTY_NAME = "Liste des accès gracieux"
|
PRETTY_NAME = "Liste des accès gracieux"
|
||||||
|
@ -421,6 +431,17 @@ class Whitelist(models.Model):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.user) + ' ' + str(self.raison)
|
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):
|
class Request(models.Model):
|
||||||
PASSWD = 'PW'
|
PASSWD = 'PW'
|
||||||
EMAIL = 'EM'
|
EMAIL = 'EM'
|
||||||
|
|
Loading…
Reference in a new issue