mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-27 07:02:26 +00:00
Activation de la synchro ldap users
This commit is contained in:
parent
3604491582
commit
c944fbb917
3 changed files with 37 additions and 16 deletions
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
@ -339,12 +339,12 @@ class Right(models.Model):
|
|||
@receiver(post_save, sender=Right)
|
||||
def right_post_save(sender, **kwargs):
|
||||
right = kwargs['instance'].right
|
||||
#right.ldap_sync()
|
||||
right.ldap_sync()
|
||||
|
||||
@receiver(post_delete, sender=Right)
|
||||
def right_post_delete(sender, **kwargs):
|
||||
right = kwargs['instance'].right
|
||||
#right.ldap_sync()
|
||||
right.ldap_sync()
|
||||
|
||||
class School(models.Model):
|
||||
PRETTY_NAME = "Etablissements enregistrés"
|
||||
|
@ -383,12 +383,12 @@ class ListRight(models.Model):
|
|||
@receiver(post_save, sender=ListRight)
|
||||
def listright_post_save(sender, **kwargs):
|
||||
right = kwargs['instance']
|
||||
#right.ldap_sync()
|
||||
right.ldap_sync()
|
||||
|
||||
@receiver(post_delete, sender=ListRight)
|
||||
def listright_post_delete(sender, **kwargs):
|
||||
right = kwargs['instance']
|
||||
#right.ldap_del()
|
||||
right.ldap_del()
|
||||
|
||||
class ListShell(models.Model):
|
||||
PRETTY_NAME = "Liste des shells disponibles"
|
||||
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue