Mercurial > kallithea
changeset 8620:a2d8c1f61657
ssh: update authorized_keys after deleting a user with ssh keys
This fixes a minor problem with minimal impact: The authorized_keys entries
would fail anyway when the referenced user wasn't found ... and the entries
would go away next time authorized_keys for some reason were updated.
Reported by Louis Bertrand.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 03 Aug 2020 20:29:20 +0200 |
parents | d442d8395b75 |
children | 3070f9bc6ebe |
files | kallithea/controllers/admin/users.py |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/admin/users.py Sat Aug 22 21:22:51 2020 +0200 +++ b/kallithea/controllers/admin/users.py Mon Aug 03 20:29:20 2020 +0200 @@ -182,6 +182,7 @@ def delete(self, id): usr = User.get_or_404(id) + has_ssh_keys = bool(usr.ssh_keys) try: UserModel().delete(usr) Session().commit() @@ -192,6 +193,9 @@ log.error(traceback.format_exc()) h.flash(_('An error occurred during deletion of user'), category='error') + else: + if has_ssh_keys: + SshKeyModel().write_authorized_keys() raise HTTPFound(location=url('users')) def _get_user_or_raise_if_default(self, id):