From 6b1ad1fa6644215b17ecee95578eb20401ef3ab8 Mon Sep 17 00:00:00 2001 From: Benjamin Graillot Date: Tue, 7 Aug 2018 15:15:30 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20du=20home=20par=20d=C3=A9faut=20dans=20?= =?UTF-8?q?les=20pr=C3=A9f=C3=A9rences?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- preferences/models.py | 5 +++++ users/models.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) 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]