diff options
author | Paweł Bogusławski <pawel.boguslawski@ib.pl> | 2020-12-21 15:39:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-21 15:39:41 +0100 |
commit | 839daa85aaba5172b3dd2b3f882aa9639a09f13a (patch) | |
tree | cc99ed17087fd3b3b44cdb650efe16e6f0394e55 /templates | |
parent | 3a500cf8c4b7892e13cb506af6fe3ab5c1c2faff (diff) | |
download | gitea-839daa85aaba5172b3dd2b3f882aa9639a09f13a.tar.gz gitea-839daa85aaba5172b3dd2b3f882aa9639a09f13a.zip |
Added option to disable migrations (#13114)
* Added option to disable migrations
This patch introduces DISABLE_MIGRATIONS parameter in [repository]
section of app.ini (by default set to false). If set to true
it blocks access to repository migration feature.
This mod hides also local repo import option in user editor if
local repo importing or migrations is disabled.
* Alter Example config
DISABLE_MIGRATIONS set to false in example config to
match its default value.
* HTTP error 403 instead of 500 on denied access to migration
* Parameter DISABLE_MIGRATIONS exposed via API
Fixes: 04b04cf854bcb3ed7659442bcf79822bdebe29e9
Author-Change-Id: IB#1105130
Diffstat (limited to 'templates')
-rw-r--r-- | templates/admin/user/edit.tmpl | 2 | ||||
-rw-r--r-- | templates/base/head_navbar.tmpl | 8 | ||||
-rw-r--r-- | templates/swagger/v1_json.tmpl | 4 |
3 files changed, 10 insertions, 4 deletions
diff --git a/templates/admin/user/edit.tmpl b/templates/admin/user/edit.tmpl index 7f1706e55a..d6cbdd5f53 100644 --- a/templates/admin/user/edit.tmpl +++ b/templates/admin/user/edit.tmpl @@ -95,7 +95,7 @@ <input name="allow_git_hook" type="checkbox" {{if .User.CanEditGitHook}}checked{{end}} {{if DisableGitHooks}}disabled{{end}}> </div> </div> - <div class="inline field"> + <div class="inline field" {{if or (DisableImportLocal) (.DisableMigrations)}}hidden{{end}}> <div class="ui checkbox"> <label><strong>{{.i18n.Tr "admin.users.allow_import_local"}}</strong></label> <input name="allow_import_local" type="checkbox" {{if .User.CanImportLocal}}checked{{end}} {{if DisableImportLocal}}disabled{{end}}> diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index 5ce07ff8c5..207c522ee8 100644 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -89,9 +89,11 @@ <a class="item" href="{{AppSubUrl}}/repo/create"> <span class="fitted">{{svg "octicon-plus"}}</span> {{.i18n.Tr "new_repo"}} </a> - <a class="item" href="{{AppSubUrl}}/repo/migrate"> - <span class="fitted">{{svg "octicon-repo-push"}}</span> {{.i18n.Tr "new_migrate"}} - </a> + {{if not .DisableMigrations}} + <a class="item" href="{{AppSubUrl}}/repo/migrate"> + <span class="fitted">{{svg "octicon-repo-push"}}</span> {{.i18n.Tr "new_migrate"}} + </a> + {{end}} {{if .SignedUser.CanCreateOrganization}} <a class="item" href="{{AppSubUrl}}/org/create"> <span class="fitted">{{svg "octicon-organization"}}</span> {{.i18n.Tr "new_org"}} diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index aa31b3f078..bb3b6b4fed 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -13688,6 +13688,10 @@ "type": "boolean", "x-go-name": "HTTPGitDisabled" }, + "migrations_disabled": { + "type": "boolean", + "x-go-name": "MigrationsDisabled" + }, "mirrors_disabled": { "type": "boolean", "x-go-name": "MirrorsDisabled" |