From 83ef6d773dc6d21f9721588d1144bedf8af1a259 Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sun, 27 Nov 2022 14:14:00 +0100 Subject: [PATCH] Make it clear that we don't delete users --- core/admin/mailu/manage.py | 12 ------------ core/admin/mailu/ui/templates/user/list.html | 1 - core/admin/mailu/ui/views/users.py | 13 ------------- docs/cli.rst | 8 -------- docs/webadministration.rst | 2 -- 5 files changed, 36 deletions(-) diff --git a/core/admin/mailu/manage.py b/core/admin/mailu/manage.py index 32619fe3..68f3fcea 100644 --- a/core/admin/mailu/manage.py +++ b/core/admin/mailu/manage.py @@ -400,18 +400,6 @@ def config_export(full=False, secrets=False, color=False, dns=False, output=None finally: os.umask(old_umask) - -@mailu.command() -@click.argument('email') -@with_appcontext -def user_delete(email): - """delete user""" - user = models.User.query.get(email) - if user: - db.session.delete(user) - db.session.commit() - - @mailu.command() @click.argument('email') @with_appcontext diff --git a/core/admin/mailu/ui/templates/user/list.html b/core/admin/mailu/ui/templates/user/list.html index 1c845062..f5215dc0 100644 --- a/core/admin/mailu/ui/templates/user/list.html +++ b/core/admin/mailu/ui/templates/user/list.html @@ -31,7 +31,6 @@   -   diff --git a/core/admin/mailu/ui/views/users.py b/core/admin/mailu/ui/views/users.py index c7d252a9..7f7e0ab3 100644 --- a/core/admin/mailu/ui/views/users.py +++ b/core/admin/mailu/ui/views/users.py @@ -80,19 +80,6 @@ def user_edit(user_email): domain=user.domain, max_quota_bytes=max_quota_bytes) -@ui.route('/user/delete/', methods=['GET', 'POST']) -@access.domain_admin(models.User, 'user_email') -@access.confirmation_required("delete {user_email}") -def user_delete(user_email): - user = models.User.query.get(user_email) or flask.abort(404) - domain = user.domain - models.db.session.delete(user) - models.db.session.commit() - flask.flash('User %s deleted' % user) - return flask.redirect( - flask.url_for('.user_list', domain_name=domain.name)) - - @ui.route('/user/settings', methods=['GET', 'POST'], defaults={'user_email': None}) @ui.route('/user/usersettings/', methods=['GET', 'POST']) @access.owner(models.User, 'user_email') diff --git a/docs/cli.rst b/docs/cli.rst index 36815fd0..5bed6707 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -9,7 +9,6 @@ Managing users and aliases can be done from CLI using commands: * password * user * user-import -* user-delete * config-update * config-export * config-import @@ -63,13 +62,6 @@ primary difference with simple `user` command is that password is being imported docker-compose run --rm admin flask mailu user-import myuser example.net '$6$51ebe0cb9f1dab48effa2a0ad8660cb489b445936b9ffd812a0b8f46bca66dd549fea530ce' 'SHA512-CRYPT' -user-delete ------------ - -.. code-block:: bash - - docker-compose exec admin flask mailu user-delete foo@example.net - config-update ------------- diff --git a/docs/webadministration.rst b/docs/webadministration.rst index 7e2a5728..5409a3dd 100644 --- a/docs/webadministration.rst +++ b/docs/webadministration.rst @@ -313,8 +313,6 @@ This page is also accessible for domain managers. On the users page new users ca * Edit. For all available options see :ref:`the Add user page `. -* Delete. Deletes the user. The Admin GUI will ask for confirmation if the user must be really deleted. - * Setting. Access the settings page of the user. See :ref:`the settings page ` for more information. * Auto-reply. Access the auto-reply page of the user. See the :ref:`auto-reply page ` for more information.