Keep aliases for the first user

This commit is contained in:
Kay0u 2020-03-28 18:33:00 +01:00
parent 6fbb153272
commit b3ccc9273a
No known key found for this signature in database
GPG key ID: 7FF262C033518333

View file

@ -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: