mirror of https://github.com/gogs/gogs.git
models: rename RewriteAllPublicKeys -> RewriteAuthorizedKeys
parent
0d2398aaff
commit
a855abf8c0
|
@ -27,7 +27,7 @@ to make automatic initialization process more smoothly`,
|
|||
subcmdDeleteRepositoryArchives,
|
||||
subcmdDeleteMissingRepositories,
|
||||
subcmdGitGcRepos,
|
||||
subcmdRewriteAllPublicKeys,
|
||||
subcmdRewriteAuthorizedKeys,
|
||||
subcmdSyncRepositoryHooks,
|
||||
subcmdReinitMissingRepositories,
|
||||
},
|
||||
|
@ -94,11 +94,11 @@ to make automatic initialization process more smoothly`,
|
|||
},
|
||||
}
|
||||
|
||||
subcmdRewriteAllPublicKeys = cli.Command{
|
||||
Name: "rewrite-public-keys",
|
||||
subcmdRewriteAuthorizedKeys = cli.Command{
|
||||
Name: "rewrite-authorized-keys",
|
||||
Usage: "Rewrite '.ssh/authorized_keys' file (caution: non-Gogs keys will be lost)",
|
||||
Action: adminDashboardOperation(
|
||||
models.RewriteAllPublicKeys,
|
||||
models.RewriteAuthorizedKeys,
|
||||
"All public keys have been rewritten successfully",
|
||||
),
|
||||
Flags: []cli.Flag{
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -853,7 +853,7 @@ func DeleteUser(u *User) (err error) {
|
|||
return err
|
||||
}
|
||||
|
||||
return RewriteAllPublicKeys()
|
||||
return RewriteAuthorizedKeys()
|
||||
}
|
||||
|
||||
// DeleteInactivateUsers deletes all inactivate users and email addresses.
|
||||
|
|
|
@ -151,7 +151,7 @@ func Dashboard(c *context.Context) {
|
|||
err = models.GitGcRepos()
|
||||
case SYNC_SSH_AUTHORIZED_KEY:
|
||||
success = c.Tr("admin.dashboard.resync_all_sshkeys_success")
|
||||
err = models.RewriteAllPublicKeys()
|
||||
err = models.RewriteAuthorizedKeys()
|
||||
case SYNC_REPOSITORY_HOOKS:
|
||||
success = c.Tr("admin.dashboard.resync_all_hooks_success")
|
||||
err = models.SyncRepositoryHooks()
|
||||
|
|
Loading…
Reference in New Issue