From b3ccc9273a68af25eaa941d0bb1cb6b5e0519cb5 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Sat, 28 Mar 2020 18:33:00 +0100 Subject: [PATCH] Keep aliases for the first user --- src/yunohost/user.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/yunohost/user.py b/src/yunohost/user.py index 82dd72cf7..39a2d8f15 100644 --- a/src/yunohost/user.py +++ b/src/yunohost/user.py @@ -192,6 +192,10 @@ def user_create(operation_logger, username, firstname, lastname, mail, password, 'loginShell': '/bin/false' } + # If it is the first user, add some aliases + if not ldap.search(base='ou=users,dc=yunohost,dc=org', filter='uid=*'): + attr_dict['mail'] = [attr_dict['mail']] + aliases + try: ldap.add('uid=%s,ou=users' % username, attr_dict) except Exception as e: