Mercurial > kallithea
changeset 8083:44e18bd4c3b2 stable
ssh: make it clear that SshKeyModel.delete has user as mandatory parameter
It is already provided in the two uses:
kallithea/controllers/admin/my_account.py: SshKeyModel().delete(fingerprint, request.authuser.user_id)
kallithea/controllers/admin/users.py: SshKeyModel().delete(fingerprint, c.user.user_id)
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 30 Dec 2019 01:38:59 +0100 |
parents | 3cab6bc45cc3 |
children | 1ba3aeefe033 |
files | kallithea/model/ssh_key.py |
diffstat | 1 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/model/ssh_key.py Sun Dec 29 15:11:13 2019 +0100 +++ b/kallithea/model/ssh_key.py Mon Dec 30 01:38:59 2019 +0100 @@ -72,17 +72,15 @@ return new_ssh_key - def delete(self, fingerprint, user=None): + def delete(self, fingerprint, user): """ - Deletes ssh key with given fingerprint. If user is set, it also filters - the object for deletion by given user. + Deletes ssh key with given fingerprint for the given user. Will raise SshKeyModelException on errors """ ssh_key = UserSshKeys.query().filter(UserSshKeys.fingerprint == fingerprint) - if user: - user = User.guess_instance(user) - ssh_key = ssh_key.filter(UserSshKeys.user_id == user.user_id) + user = User.guess_instance(user) + ssh_key = ssh_key.filter(UserSshKeys.user_id == user.user_id) ssh_key = ssh_key.scalar() if ssh_key is None: