From 0ed392cec00b44a77a6e315ee9eb843178ac4119 Mon Sep 17 00:00:00 2001 From: chateau Date: Sun, 16 Dec 2018 22:29:31 +0100 Subject: [PATCH] Added removal of "/var/mail/" directory when removing user with --purge option. --- data/actionsmap/yunohost.yml | 1 + src/yunohost/user.py | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/data/actionsmap/yunohost.yml b/data/actionsmap/yunohost.yml index ba5f1d505..c60940c23 100644 --- a/data/actionsmap/yunohost.yml +++ b/data/actionsmap/yunohost.yml @@ -148,6 +148,7 @@ user: extra: pattern: *pattern_username --purge: + help: Purge user's home and mail directories action: store_true ### user_update() diff --git a/src/yunohost/user.py b/src/yunohost/user.py index bb39dd58e..c45ada19f 100644 --- a/src/yunohost/user.py +++ b/src/yunohost/user.py @@ -256,6 +256,7 @@ def user_delete(operation_logger, auth, username, purge=False): if auth.update('cn=sftpusers,ou=groups', {'memberUid': memberlist}): if purge: subprocess.call(['rm', '-rf', '/home/{0}'.format(username)]) + subprocess.call(['rm', '-rf', '/var/mail/{0}'.format(username)]) else: raise MoulinetteError(169, m18n.n('user_deletion_failed')) @@ -532,6 +533,3 @@ def _hash_user_password(password): salt = '$6$' + salt + '$' return '{CRYPT}' + crypt.crypt(str(password), salt) - - -