File tree Expand file tree Collapse file tree 10 files changed +184
-187
lines changed
gitea-repositories-meta/user2/git_hooks_test.git/hooks/pre-receive.d Expand file tree Collapse file tree 10 files changed +184
-187
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,9 @@ import (
1313 "code.gitea.io/gitea/modules/log"
1414)
1515
16+ // Security settings
17+
1618var (
17- // Security settings
1819 InstallLock bool
1920 SecretKey string
2021 InternalToken string // internal access token
2728 ReverseProxyTrustedProxies []string
2829 MinPasswordLength int
2930 ImportLocalPaths bool
30- DisableGitHooks bool
31+ DisableGitHooks = true
3132 DisableWebhooks bool
3233 OnlyAllowPushIfGiteaEnvironmentSet bool
3334 PasswordComplexity []string
Original file line number Diff line number Diff line change @@ -131,15 +131,9 @@ func NewFuncMap() template.FuncMap {
131131 "EnableTimetracking" : func () bool {
132132 return setting .Service .EnableTimetracking
133133 },
134- "DisableGitHooks" : func () bool {
135- return setting .DisableGitHooks
136- },
137134 "DisableWebhooks" : func () bool {
138135 return setting .DisableWebhooks
139136 },
140- "DisableImportLocal" : func () bool {
141- return ! setting .ImportLocalPaths
142- },
143137 "UserThemeName" : userThemeName ,
144138 "NotificationSettings" : func () map [string ]any {
145139 return map [string ]any {
Original file line number Diff line number Diff line change @@ -313,6 +313,8 @@ func editUserCommon(ctx *context.Context) {
313313 ctx .Data ["PageIsAdminUsers" ] = true
314314 ctx .Data ["DisableRegularOrgCreation" ] = setting .Admin .DisableRegularOrgCreation
315315 ctx .Data ["DisableMigrations" ] = setting .Repository .DisableMigrations
316+ ctx .Data ["DisableGitHooks" ] = setting .DisableGitHooks
317+ ctx .Data ["DisableImportLocal" ] = ! setting .ImportLocalPaths
316318 ctx .Data ["AllowedUserVisibilityModes" ] = setting .Service .AllowedUserVisibilityModesSlice .ToVisibleTypeSlice ()
317319 ctx .Data ["DisableGravatar" ] = setting .Config ().Picture .DisableGravatar .Value (ctx )
318320}
Original file line number Diff line number Diff line change 128128 <input name="restricted" type="checkbox" {{if .User.IsRestricted}}checked{{end}}>
129129 </div>
130130 </div>
131- <div class="inline field {{if DisableGitHooks}}tw-hidden{{end}}">
131+ <div class="inline field {{if . DisableGitHooks}}tw-hidden{{end}}">
132132 <div class="ui checkbox" data-tooltip-content="{{ctx.Locale.Tr "admin.users.allow_git_hook_tooltip"}}">
133133 <label><strong>{{ctx.Locale.Tr "admin.users.allow_git_hook"}}</strong></label>
134- <input name="allow_git_hook" type="checkbox" {{if .User.CanEditGitHook}}checked{{end}} {{if DisableGitHooks}}disabled{{end}}>
134+ <input name="allow_git_hook" type="checkbox" {{if .User.CanEditGitHook}}checked{{end}} {{if . DisableGitHooks}}disabled{{end}}>
135135 </div>
136136 </div>
137- <div class="inline field {{if or (DisableImportLocal) (.DisableMigrations)}}tw-hidden{{end}}">
137+ <div class="inline field {{if or (. DisableImportLocal) (.DisableMigrations)}}tw-hidden{{end}}">
138138 <div class="ui checkbox">
139139 <label><strong>{{ctx.Locale.Tr "admin.users.allow_import_local"}}</strong></label>
140- <input name="allow_import_local" type="checkbox" {{if .User.CanImportLocal}}checked{{end}} {{if DisableImportLocal}}disabled{{end}}>
140+ <input name="allow_import_local" type="checkbox" {{if .User.CanImportLocal}}checked{{end}} {{if . DisableImportLocal}}disabled{{end}}>
141141 </div>
142142 </div>
143143 {{if not .DisableRegularOrgCreation}}
Original file line number Diff line number Diff line change 11#! /bin/bash
2-
3- echo Hello, World!
2+ echo " TestGitHookScript"
You can’t perform that action at this time.
0 commit comments