summaryrefslogtreecommitdiffstats
path: root/models/publickey.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-03-07 11:34:41 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-03-07 11:34:41 +0800
commit8e821c75d7432ffe7eb7d72ba479f6f68e620ad1 (patch)
treedb8dc69812e3a9dd0a8cda9a17555c09b3e048b5 /models/publickey.go
parente246f2188ec1d2a7582bd9964abbe5f3d2ee2ee9 (diff)
downloadgitea-8e821c75d7432ffe7eb7d72ba479f6f68e620ad1.tar.gz
gitea-8e821c75d7432ffe7eb7d72ba479f6f68e620ad1.zip
add publickey list
Diffstat (limited to 'models/publickey.go')
-rw-r--r--models/publickey.go6
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)