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

Merge branch 'get_shadow_expirefunc' into 'master'

Function for shadow expire

See merge request federez/re2o!187
This commit is contained in:
moamoak 2018-07-20 13:43:07 +02:00
commit 7cafc9e99d

View file

@ -321,6 +321,14 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
si il n'est pas défini""" si il n'est pas défini"""
return self.shell or OptionalUser.get_cached_value('shell_default') return self.shell or OptionalUser.get_cached_value('shell_default')
@cached_property
def get_shadow_expire(self):
"""Return the shadow_expire value for the user"""
if self.state == self.STATE_DISABLED:
return str(0)
else:
return None
def end_adhesion(self): def end_adhesion(self):
""" Renvoie la date de fin d'adhésion d'un user. Examine les objets """ Renvoie la date de fin d'adhésion d'un user. Examine les objets
cotisation""" cotisation"""
@ -522,10 +530,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
user_ldap.sambat_nt_password = self.pwd_ntlm.upper() user_ldap.sambat_nt_password = self.pwd_ntlm.upper()
if self.get_shell: if self.get_shell:
user_ldap.login_shell = str(self.get_shell) user_ldap.login_shell = str(self.get_shell)
if self.state == self.STATE_DISABLED: user_ldap.shadowexpire = self.get_shadow_expire
user_ldap.shadowexpire = str(0)
else:
user_ldap.shadowexpire = None
if access_refresh: if access_refresh:
user_ldap.dialupAccess = str(self.has_access()) user_ldap.dialupAccess = str(self.has_access())
if mac_refresh: if mac_refresh: