diff options
author | Yixin Hao <haoyixin@live.cn> | 2015-08-21 15:27:38 +0800 |
---|---|---|
committer | Yixin Hao <haoyixin@live.cn> | 2015-08-21 15:27:38 +0800 |
commit | 50cd67cd4bf9e03a555cbf44bcd76ca12a315b97 (patch) | |
tree | 55a8e7dc63ae4a8171be2874fb3f2e285b1607ee /models/publickey.go | |
parent | 78b717f202dd989f3871fccd0bc8935fe709fac1 (diff) | |
parent | 461f715ae4699557571652d9d3baec9a4438796f (diff) | |
download | gitea-50cd67cd4bf9e03a555cbf44bcd76ca12a315b97.tar.gz gitea-50cd67cd4bf9e03a555cbf44bcd76ca12a315b97.zip |
Merge pull request #2 from gogits/develop
Update Develop
Diffstat (limited to 'models/publickey.go')
-rw-r--r-- | models/publickey.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/models/publickey.go b/models/publickey.go index 400486eba7..e5516526bc 100644 --- a/models/publickey.go +++ b/models/publickey.go @@ -466,7 +466,15 @@ func deletePublicKey(e *xorm.Session, key *PublicKey) error { } // DeletePublicKey deletes SSH key information both in database and authorized_keys file. -func DeletePublicKey(key *PublicKey) (err error) { +func DeletePublicKey(id int64) (err error) { + key := &PublicKey{ID: id} + has, err := x.Id(key.ID).Get(key) + if err != nil { + return err + } else if !has { + return nil + } + sess := x.NewSession() defer sessionRelease(sess) if err = sess.Begin(); err != nil { |