Skip to content

Commit e3d4d70

Browse files
committed
Redundant function removed and cron tasks disabling fixed
Removed redundant DisableSwagger; existing EnableSwagger is used instead. Fixed disabling registerRewriteAllPublicKeys and registerRewriteAllPrincipalKeys cron tasks. Author-Change-Id: IB#1105071
1 parent 45a0b14 commit e3d4d70

File tree

6 files changed

+10
-13
lines changed

6 files changed

+10
-13
lines changed

modules/cron/tasks_extended.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,12 @@ func initExtendedTasks() {
121121
registerDeleteInactiveUsers()
122122
registerDeleteRepositoryArchives()
123123
registerGarbageCollectRepositories()
124-
if !setting.SSH.Disabled {
124+
if !setting.SSH.Disabled && !setting.SSH.StartBuiltinServer && setting.SSH.CreateAuthorizedKeysFile {
125125
registerRewriteAllPublicKeys()
126126
}
127-
registerRewriteAllPrincipalKeys()
127+
if !setting.SSH.Disabled && !setting.SSH.StartBuiltinServer && setting.SSH.CreateAuthorizedPrincipalsFile {
128+
registerRewriteAllPrincipalKeys()
129+
}
128130
if !setting.DisableGitHooks {
129131
registerRepositoryUpdateHook()
130132
}

modules/templates/helper.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,6 @@ func NewFuncMap() []template.FuncMap {
231231
"DisableSSH": func() bool {
232232
return setting.SSH.Disabled
233233
},
234-
"DisableSwagger": func() bool {
235-
return !setting.API.EnableSwagger
236-
},
237234
"DisableOAuth2": func() bool {
238235
return !setting.OAuth2.Enable
239236
},

templates/admin/dashboard.tmpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,20 @@
3535
<td>{{.i18n.Tr "admin.dashboard.git_gc_repos"}}</td>
3636
<td><button type="submit" class="ui green button" name="op" value="git_gc_repos">{{svg "octicon-play"}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
3737
</tr>
38-
{{if and (not .SSH.Disabled) (not .SSH.StartBuiltinServer)}}
38+
{{if and (not .SSH.Disabled) (not .SSH.StartBuiltinServer) (.SSH.CreateAuthorizedKeysFile) }}
3939
<tr>
4040
<td>{{.i18n.Tr "admin.dashboard.resync_all_sshkeys"}}<br/>
4141
{{.i18n.Tr "admin.dashboard.resync_all_sshkeys.desc"}}</td>
4242
<td><button type="submit" class="ui green button" name="op" value="resync_all_sshkeys">{{svg "octicon-play"}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
4343
</tr>
4444
{{end}}
45+
{{if and (not .SSH.Disabled) (not .SSH.StartBuiltinServer) (.SSH.CreateAuthorizedPrincipalsFile) }}
4546
<tr>
4647
<td>{{.i18n.Tr "admin.dashboard.resync_all_sshprincipals"}}<br/>
4748
{{.i18n.Tr "admin.dashboard.resync_all_sshprincipals.desc"}}</td>
4849
<td><button type="submit" class="ui green button" name="op" value="resync_all_sshprincipals">{{svg "octicon-play" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
4950
</tr>
51+
{{end}}
5052
{{if not DisableGitHooks}}
5153
<tr>
5254
<td>{{.i18n.Tr "admin.dashboard.resync_all_hooks"}}</td>

templates/user/settings/applications.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{{template "user/settings/navbar" .}}
44
<div class="ui container">
55
{{template "base/alert" .}}
6-
{{if not DisableSwagger}}
6+
{{if .EnableSwagger}}
77
<h4 class="ui top attached header">
88
{{.i18n.Tr "settings.manage_access_token"}}
99
</h4>

templates/user/settings/keys_principal.tmpl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
{{if .AllowPrincipals}}
1+
{{if and .AllowPrincipals (not DisableSSH)}}
22
<h4 class="ui top attached header">
33
{{.i18n.Tr "settings.manage_ssh_principals"}}
44
<div class="ui right">
5-
{{if not .DisableSSH}}
65
<div class="ui blue tiny show-panel button" data-panel="#add-ssh-principal-panel">{{.i18n.Tr "settings.add_new_principal"}}</div>
7-
{{else}}
8-
<div class="ui blue tiny button disabled">{{.i18n.Tr "settings.ssh_disabled"}}</div>
9-
{{end}}
106
</div>
117
</h4>
128
<div class="ui attached segment">

templates/user/settings/navbar.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<a class="{{if .PageIsSettingsSecurity}}active{{end}} item" href="{{AppSubUrl}}/user/settings/security">
99
{{.i18n.Tr "settings.security"}}
1010
</a>
11-
{{if or (not DisableSwagger) (not DisableOAuth2)}}
11+
{{if or .EnableSwagger (not DisableOAuth2)}}
1212
<a class="{{if .PageIsSettingsApplications}}active{{end}} item" href="{{AppSubUrl}}/user/settings/applications">
1313
{{.i18n.Tr "settings.applications"}}
1414
</a>

0 commit comments

Comments
 (0)