Moar oopsies

This commit is contained in:
Alexandre Aubin 2022-10-09 20:52:20 +02:00
parent 4822afb9d6
commit e32fe7aa41

View file

@ -147,7 +147,7 @@ def user_create(
if firstname or lastname: if firstname or lastname:
logger.warning("Options --firstname / --lastname of 'yunohost user create' are deprecated. We recommend using --fullname instead.") logger.warning("Options --firstname / --lastname of 'yunohost user create' are deprecated. We recommend using --fullname instead.")
if not fullname.strip(): if not fullname or not fullname.strip():
if not firstname.strip(): if not firstname.strip():
raise YunohostValidationError("You should specify the fullname of the user using option -F") raise YunohostValidationError("You should specify the fullname of the user using option -F")
lastname = lastname or " " # Stupid hack because LDAP requires the sn/lastname attr, but it accepts a single whitespace... lastname = lastname or " " # Stupid hack because LDAP requires the sn/lastname attr, but it accepts a single whitespace...
@ -364,7 +364,10 @@ def user_update(
fullname=None, fullname=None,
): ):
if fullname.strip(): if firstname or lastname:
logger.warning("Options --firstname / --lastname of 'yunohost user create' are deprecated. We recommend using --fullname instead.")
if fullname and fullname.strip():
fullname = fullname.strip() fullname = fullname.strip()
firstname = fullname.split()[0] firstname = fullname.split()[0]
lastname = ' '.join(fullname.split()[1:]) or " " # Stupid hack because LDAP requires the sn/lastname attr, but it accepts a single whitespace... lastname = ' '.join(fullname.split()[1:]) or " " # Stupid hack because LDAP requires the sn/lastname attr, but it accepts a single whitespace...
@ -855,7 +858,7 @@ def user_import(operation_logger, csvfile, update=False, delete=False):
new_infos["username"], new_infos["username"],
firstname=new_infos["firstname"], firstname=new_infos["firstname"],
lastname=new_infos["lastname"], lastname=new_infos["lastname"],
password=new_infos["password"], change_password=new_infos["password"],
mailbox_quota=new_infos["mailbox-quota"], mailbox_quota=new_infos["mailbox-quota"],
mail=new_infos["mail"], mail=new_infos["mail"],
add_mailalias=new_infos["mail-alias"], add_mailalias=new_infos["mail-alias"],