From 5805acbf6a124cb548d34077803dfcbfa1d1cca4 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 5 Sep 2020 18:35:35 +0200 Subject: [PATCH] Reimplement --mail as a deprecated option --- data/actionsmap/yunohost.yml | 3 +++ src/yunohost/user.py | 26 +++++--------------------- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/data/actionsmap/yunohost.yml b/data/actionsmap/yunohost.yml index e0f33e554..054418ebd 100644 --- a/data/actionsmap/yunohost.yml +++ b/data/actionsmap/yunohost.yml @@ -97,6 +97,9 @@ user: pattern: &pattern_lastname - !!str ^([^\W\d_]{2,30}[ ,.'-]{0,3})+$ - "pattern_lastname" + -m: + full: --mail + help: (Deprecated, see --domain) Main unique email address -p: full: --password help: User password diff --git a/src/yunohost/user.py b/src/yunohost/user.py index 2f5c13d97..77062b6da 100644 --- a/src/yunohost/user.py +++ b/src/yunohost/user.py @@ -46,16 +46,7 @@ logger = getActionLogger('yunohost.user') def user_list(fields=None): - """ - List users - Keyword argument: - filter -- LDAP filter used to search - offset -- Starting number for user fetching - limit -- Maximum number of user fetched - fields -- fields to fetch - - """ from yunohost.utils.ldap import _get_ldap_interface user_attrs = { @@ -106,19 +97,8 @@ def user_list(fields=None): @is_unit_operation([('username', 'user')]) def user_create(operation_logger, username, firstname, lastname, domain, password, - mailbox_quota="0"): - """ - Create user + mailbox_quota="0", mail=None): - Keyword argument: - firstname - lastname - username -- Must be unique - mail -- Main mail address must be unique - password - mailbox_quota -- Mailbox size quota - - """ from yunohost.domain import domain_list, _get_maindomain from yunohost.hook import hook_callback from yunohost.utils.password import assert_password_is_strong_enough @@ -127,6 +107,10 @@ def user_create(operation_logger, username, firstname, lastname, domain, passwor # Ensure sufficiently complex password assert_password_is_strong_enough("user", password) + if mail is not None: + logger.warning("Packagers ! Using --mail in 'yunohost user create' is deprecated ... please use --domain instead.") + domain = mail.split("@")[-1] + # Validate domain used for email address/xmpp account if domain is None: if msettings.get('interface') == 'api':