Merge pull request #602 from eauchat/stretch-unstable

Also remove /var/mail/<username> directory on user delete (with --purge option)
This commit is contained in:
Alexandre Aubin 2018-12-20 17:44:00 +01:00 committed by GitHub
commit 3e1064a3df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View file

@ -148,6 +148,7 @@ user:
extra:
pattern: *pattern_username
--purge:
help: Purge user's home and mail directories
action: store_true
### user_update()

View file

@ -251,6 +251,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 YunohostError('user_deletion_failed')