Changeset - a2d8c1f61657
[Not reviewed]
default
0 1 0
Mads Kiilerich (mads) - 6 years ago 2020-08-03 20:29:20
mads@kiilerich.com
Grafted from: 4a0d4dac8f40
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.
1 file changed with 4 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/admin/users.py
Show inline comments
 
@@ -182,6 +182,7 @@ class UsersController(BaseController):
 

	
 
    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 @@ class UsersController(BaseController):
 
            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):
0 comments (0 inline, 0 general)