aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorVlad Temian <vladtemian@gmail.com>2017-12-06 12:27:10 +0200
committerLauris BH <lauris@nix.lv>2017-12-06 12:27:10 +0200
commit469ab99e9a4e31c1e95ab37f363c26b62b782542 (patch)
tree610c3848c07f2d0ca8854c6fb989f72e8a656b3b /models
parentc7fb6e30870ea1abff13a8214107e0747d293320 (diff)
downloadgitea-469ab99e9a4e31c1e95ab37f363c26b62b782542.tar.gz
gitea-469ab99e9a4e31c1e95ab37f363c26b62b782542.zip
Delete a user's public key via admin api (closes #3014) (#3059)
* Delete a user's public key via admin api * Test admin ssh endpoint for creating a new ssh key * Adapt public ssh key test to also test the delete operation * Test that deleting a missing key will result in a 404 * Test that a normal user can't delete another user's ssh key * Make DeletePublicKey return err * Update swagger doc
Diffstat (limited to 'models')
-rw-r--r--models/ssh_key.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/models/ssh_key.go b/models/ssh_key.go
index 2d9f521fd4..9365fab1ab 100644
--- a/models/ssh_key.go
+++ b/models/ssh_key.go
@@ -506,10 +506,7 @@ func deletePublicKeys(e *xorm.Session, keyIDs ...int64) error {
func DeletePublicKey(doer *User, id int64) (err error) {
key, err := GetPublicKeyByID(id)
if err != nil {
- if IsErrKeyNotExist(err) {
- return nil
- }
- return fmt.Errorf("GetPublicKeyByID: %v", err)
+ return err
}
// Check if user has access to delete this key.