add publickey list
This commit is contained in:
parent
e246f2188e
commit
8e821c75d7
6 changed files with 45 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue