diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2014-03-07 11:34:41 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2014-03-07 11:34:41 +0800 |
commit | 8e821c75d7432ffe7eb7d72ba479f6f68e620ad1 (patch) | |
tree | db8dc69812e3a9dd0a8cda9a17555c09b3e048b5 /models/publickey.go | |
parent | e246f2188ec1d2a7582bd9964abbe5f3d2ee2ee9 (diff) | |
download | gitea-8e821c75d7432ffe7eb7d72ba479f6f68e620ad1.tar.gz gitea-8e821c75d7432ffe7eb7d72ba479f6f68e620ad1.zip |
add publickey list
Diffstat (limited to 'models/publickey.go')
-rw-r--r-- | models/publickey.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/models/publickey.go b/models/publickey.go index 49863d8c0b..ea5af8816b 100644 --- a/models/publickey.go +++ b/models/publickey.go @@ -77,6 +77,12 @@ func AddPublicKey(key *PublicKey) error { return nil } +func ListPublicKey(userId int64) ([]PublicKey, error) { + keys := make([]PublicKey, 0) + err := orm.Find(&keys, &PublicKey{OwnerId: userId}) + return keys, err +} + func SaveAuthorizedKeyFile(key *PublicKey) error { p := filepath.Join(sshPath, "authorized_keys") f, err := os.OpenFile(p, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600) |