8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 11:23:10 +00:00

Ajout du home par défaut dans les préférences

This commit is contained in:
Benjamin Graillot 2018-08-07 15:15:30 +02:00 committed by esum
parent 49646ae34b
commit 6b1ad1fa66
2 changed files with 6 additions and 1 deletions

View file

@ -98,6 +98,11 @@ class OptionalUser(AclMixin, PreferencesModel):
default = 15, default = 15,
help_text = "Maximum number of local email address for a standard user" help_text = "Maximum number of local email address for a standard user"
) )
default_home_path = models.CharField(
max_length = 256,
default = "/home/{0}",
help_text = "Chemin par défaut du home des utilisateurs, formaté avec le pseudo"
)
class Meta: class Meta:
permissions = ( permissions = (

View file

@ -537,7 +537,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
user_ldap.name = self.pseudo user_ldap.name = self.pseudo
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 = OptionalUser.get_cached_value('default_home_path').format(self.pseudo)
user_ldap.mail = self.email user_ldap.mail = self.email
user_ldap.given_name = self.surname.lower() + '_'\ user_ldap.given_name = self.surname.lower() + '_'\
+ self.name.lower()[:3] + self.name.lower()[:3]