models: rename RewriteAllPublicKeys -> RewriteAuthorizedKeys

This commit is contained in:
Unknwon
2018-03-30 01:26:36 -04:00
parent 0d2398aaff
commit a855abf8c0
4 changed files with 11 additions and 9 deletions

View File

@@ -512,16 +512,18 @@ func DeletePublicKey(doer *User, id int64) (err error) {
return err
}
return RewriteAllPublicKeys()
return RewriteAuthorizedKeys()
}
// RewriteAllPublicKeys removes any authorized key and rewrite all keys from database again.
// RewriteAuthorizedKeys removes any authorized key and rewrite all keys from database again.
// Note: x.Iterate does not get latest data after insert/delete, so we have to call this function
// outsite any session scope independently.
func RewriteAllPublicKeys() error {
func RewriteAuthorizedKeys() error {
sshOpLocker.Lock()
defer sshOpLocker.Unlock()
log.Trace("Doing: RewriteAuthorizedKeys")
os.MkdirAll(setting.SSH.RootPath, os.ModePerm)
fpath := filepath.Join(setting.SSH.RootPath, "authorized_keys")
tmpPath := fpath + ".tmp"