changeset 7780:955bbbc29655

ssh: maintain authorized_keys file automatically Based on work by Ilya Beda <ir4y.ix@gmail.com> on https://bitbucket.org/ir4y/rhodecode/commits/branch/ssh_server_support , also heavily modified by Mads Kiilerich.
author Christian Oyarzun <oyarzun@gmail.com>
date Mon, 17 Nov 2014 14:42:45 -0500
parents a185042de98a
children 574218777086
files kallithea/controllers/admin/my_account.py kallithea/controllers/admin/users.py
diffstat 2 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/admin/my_account.py	Sun Jun 30 13:31:56 2019 +0200
+++ b/kallithea/controllers/admin/my_account.py	Mon Nov 17 14:42:45 2014 -0500
@@ -276,6 +276,7 @@
             new_ssh_key = SshKeyModel().create(request.authuser.user_id,
                                                description, public_key)
             Session().commit()
+            SshKeyModel().write_authorized_keys()
             h.flash(_("SSH key %s successfully added") % new_ssh_key.fingerprint, category='success')
         except SshKeyModelException as errors:
             h.flash(errors.message, category='error')
@@ -287,6 +288,7 @@
         try:
             SshKeyModel().delete(public_key, request.authuser.user_id)
             Session().commit()
+            SshKeyModel().write_authorized_keys()
             h.flash(_("SSH key successfully deleted"), category='success')
         except SshKeyModelException as errors:
             h.flash(errors.message, category='error')
--- a/kallithea/controllers/admin/users.py	Sun Jun 30 13:31:56 2019 +0200
+++ b/kallithea/controllers/admin/users.py	Mon Nov 17 14:42:45 2014 -0500
@@ -452,6 +452,7 @@
             new_ssh_key = SshKeyModel().create(c.user.user_id,
                                                description, public_key)
             Session().commit()
+            SshKeyModel().write_authorized_keys()
             h.flash(_("SSH key %s successfully added") % new_ssh_key.fingerprint, category='success')
         except SshKeyModelException as errors:
             h.flash(errors.message, category='error')
@@ -465,6 +466,7 @@
         try:
             SshKeyModel().delete(public_key, c.user.user_id)
             Session().commit()
+            SshKeyModel().write_authorized_keys()
             h.flash(_("SSH key successfully deleted"), category='success')
         except SshKeyModelException as errors:
             h.flash(errors.message, category='error')