Changeset - 44e18bd4c3b2
[Not reviewed]
stable
0 1 0
Mads Kiilerich (mads) - 6 years ago 2019-12-30 01:38:59
mads@kiilerich.com
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)
1 file changed with 2 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/model/ssh_key.py
Show inline comments
 
@@ -72,15 +72,13 @@ class SshKeyModel(object):
 

	
 
        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)
 

	
0 comments (0 inline, 0 general)