diff --git a/preferences/models.py b/preferences/models.py index 9226bd4a..ed7e0f8d 100644 --- a/preferences/models.py +++ b/preferences/models.py @@ -98,6 +98,11 @@ class OptionalUser(AclMixin, PreferencesModel): default = 15, 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: permissions = ( diff --git a/users/models.py b/users/models.py index 42310a03..775768e9 100755 --- a/users/models.py +++ b/users/models.py @@ -537,7 +537,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser, user_ldap.name = self.pseudo user_ldap.sn = self.pseudo 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.given_name = self.surname.lower() + '_'\ + self.name.lower()[:3]