summaryrefslogtreecommitdiffstats
path: root/models/publickey.go
diff options
context:
space:
mode:
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)