Browse Source

Disable local path migration by default (#4033)

Site admin now has to enable manually by config option
[repository] ENABLE_LOCAL_PATH_MIGRATION = true.
Site admin always grants this permission, but regulars users have
to be allowed by site admins in admin user panel.
pull/3651/merge
Unknwon 8 years ago
parent
commit
ae319da5fd
No known key found for this signature in database
GPG Key ID: FB9F411CDD69BEC1
  1. 2
      README.md
  2. 2
      conf/app.ini
  3. 3
      conf/locale/locale_en-US.ini
  4. 2
      gogs.go
  5. 2
      models/user.go
  6. 2018
      modules/bindata/bindata.go
  7. 1
      public/css/gogs.css
  8. 1
      public/less/_form.less
  9. 2
      routers/admin/users.go
  10. 2
      templates/.VERSION
  11. 12
      templates/admin/user/edit.tmpl
  12. 8
      templates/repo/migrate.tmpl

2
README.md

@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
##### Current tip version: 0.9.118 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions ~~or submit a task on [alpha stage automated binary building system](https://build.gogs.io/)~~)
##### Current tip version: 0.9.119 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions ~~or submit a task on [alpha stage automated binary building system](https://build.gogs.io/)~~)
| Web | UI | Preview |
|:-------------:|:-------:|:-------:|

2
conf/app.ini

@ -26,6 +26,8 @@ PULL_REQUEST_QUEUE_LENGTH = 1000
PREFERRED_LICENSES = Apache License 2.0,MIT License
; Disable ability to interact with repositories by HTTP protocol
DISABLE_HTTP_GIT = false
; Enable ability to migrate repository by local path
ENABLE_LOCAL_PATH_MIGRATION = false
[repository.editor]
; List of file extensions that should have line wraps in the CodeMirror editor

3
conf/locale/locale_en-US.ini

@ -384,7 +384,8 @@ migrate_type = Migration Type
migrate_type_helper = This repository will be a <span class="text blue">mirror</span>
migrate_repo = Migrate Repository
migrate.clone_address = Clone Address
migrate.clone_address_desc = This can be a HTTP/HTTPS/GIT URL or local server path.
migrate.clone_address_desc = This can be a HTTP/HTTPS/GIT URL.
migrate.clone_address_desc_import_local = You're also allowed to migrate a repository by local server path.
migrate.permission_denied = You are not allowed to import local repositories.
migrate.invalid_local_path = Invalid local path, it does not exist or not a directory.
migrate.failed = Migration failed: %v

2
gogs.go

@ -16,7 +16,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
const APP_VER = "0.9.118.0125"
const APP_VER = "0.9.119.0126"
func init() {
setting.AppVer = APP_VER

2
models/user.go

@ -176,7 +176,7 @@ func (u *User) CanEditGitHook() bool {
// CanImportLocal returns true if user can migrate repository by local path.
func (u *User) CanImportLocal() bool {
return u.IsAdmin || u.AllowImportLocal
return setting.Repository.EnableLocalPathMigration && (u.IsAdmin || u.AllowImportLocal)
}
// DashboardLink returns the user dashboard page link.

2018
modules/bindata/bindata.go

File diff suppressed because one or more lines are too long

1
public/css/gogs.css

@ -908,6 +908,7 @@ footer .ui.language .menu {
padding-top: .6em;
padding-bottom: .6em;
display: inline-block;
word-break: break-all;
}
.ui.attached.header {
background: #f0f0f0;

1
public/less/_form.less

@ -4,6 +4,7 @@
padding-top: .6em;
padding-bottom: .6em;
display: inline-block;
word-break: break-all;
}
}
.ui.attached.header {

2
routers/admin/users.go

@ -155,6 +155,7 @@ func EditUser(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.users.edit_account")
ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminUsers"] = true
ctx.Data["EnableLocalPathMigration"] = setting.Repository.EnableLocalPathMigration
prepareUserInfo(ctx)
if ctx.Written() {
@ -168,6 +169,7 @@ func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) {
ctx.Data["Title"] = ctx.Tr("admin.users.edit_account")
ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminUsers"] = true
ctx.Data["EnableLocalPathMigration"] = setting.Repository.EnableLocalPathMigration
u := prepareUserInfo(ctx)
if ctx.Written() {

2
templates/.VERSION

@ -1 +1 @@
0.9.118.0125
0.9.119.0126

12
templates/admin/user/edit.tmpl

@ -91,12 +91,14 @@
<input name="allow_git_hook" type="checkbox" {{if .User.CanEditGitHook}}checked{{end}}>
</div>
</div>
<div class="inline field">
<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 .EnableLocalPathMigration}}
<div class="inline field">
<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}}>
</div>
</div>
</div>
{{end}}
<div class="ui divider"></div>

8
templates/repo/migrate.tmpl

@ -12,7 +12,13 @@
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
<label for="clone_addr">{{.i18n.Tr "repo.migrate.clone_address"}}</label>
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
<span class="help">{{.i18n.Tr "repo.migrate.clone_address_desc"}}</span>
<span class="help">
{{.i18n.Tr "repo.migrate.clone_address_desc"}}
{{if .ContextUser.CanImportLocal}}
<br>
<span class="text blue">{{.i18n.Tr "repo.migrate.clone_address_desc_import_local"}}</span>
{{end}}
</span>
</div>
<div class="ui accordion optional field">
<div class="title {{if .Err_Auth}}text red active{{end}}">

Loading…
Cancel
Save