mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-10-31 23:22:49 +00:00
Fix bug evaluation des emailaddress + func get_mail sur user
This commit is contained in:
parent
ddce1892b7
commit
50265a5c4b
1 changed files with 17 additions and 3 deletions
|
@ -273,6 +273,20 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError("Type inconnu")
|
raise NotImplementedError("Type inconnu")
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def get_mail_addresses(self):
|
||||||
|
if self.local_email_enabled:
|
||||||
|
return self.emailaddress_set.all()
|
||||||
|
return None
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def get_mail(self):
|
||||||
|
"""Return the mail address choosen by the user"""
|
||||||
|
if not OptionalUser.get_cached_value('local_email_accounts_enabled') or not self.local_email_enabled or self.local_email_redirect:
|
||||||
|
return str(self.email)
|
||||||
|
else:
|
||||||
|
return str(self.emailaddress_set.get(local_part=self.pseudo))
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def class_name(self):
|
def class_name(self):
|
||||||
"""Renvoie si il s'agit d'un adhérent ou d'un club"""
|
"""Renvoie si il s'agit d'un adhérent ou d'un club"""
|
||||||
|
@ -538,7 +552,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
user_ldap.sn = self.pseudo
|
user_ldap.sn = self.pseudo
|
||||||
user_ldap.dialupAccess = str(self.has_access())
|
user_ldap.dialupAccess = str(self.has_access())
|
||||||
user_ldap.home_directory = '/home/' + self.pseudo
|
user_ldap.home_directory = '/home/' + self.pseudo
|
||||||
user_ldap.mail = self.email
|
user_ldap.mail = self.get_mail
|
||||||
user_ldap.given_name = self.surname.lower() + '_'\
|
user_ldap.given_name = self.surname.lower() + '_'\
|
||||||
+ self.name.lower()[:3]
|
+ self.name.lower()[:3]
|
||||||
user_ldap.gid = LDAP['user_gid']
|
user_ldap.gid = LDAP['user_gid']
|
||||||
|
@ -1684,11 +1698,11 @@ class EMailAddress(RevMixin, AclMixin, models.Model):
|
||||||
verbose_name_plural = "Local email accounts"
|
verbose_name_plural = "Local email accounts"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.local_part + OptionalUser.get_cached_value('local_email_domain')
|
return str(self.local_part) + OptionalUser.get_cached_value('local_email_domain')
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def complete_email_address(self):
|
def complete_email_address(self):
|
||||||
return self.local_part + OptionalUser.get_cached_value('local_email_domain')
|
return str(self.local_part) + OptionalUser.get_cached_value('local_email_domain')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def can_create(user_request, userid, *_args, **_kwargs):
|
def can_create(user_request, userid, *_args, **_kwargs):
|
||||||
|
|
Loading…
Reference in a new issue