Browse Source

allow admin to migrate for any user/org

tags/v1.2.0-rc1
Unknwon 9 years ago
parent
commit
67ccea3792
6 changed files with 25 additions and 20 deletions
  1. +1
    -0
      conf/locale/locale_en-US.ini
  2. +1
    -1
      gogs.go
  3. +16
    -16
      modules/bindata/bindata.go
  4. +3
    -2
      routers/api/v1/repo.go
  5. +1
    -1
      templates/.VERSION
  6. +3
    -0
      templates/repo/settings/deploy_keys.tmpl

+ 1
- 0
conf/locale/locale_en-US.ini View File

@@ -612,6 +612,7 @@ settings.slack_domain = Domain
settings.slack_channel = Channel
settings.deploy_keys = Deploy Keys
settings.add_deploy_key = Add Deploy Key
settings.deploy_key_desc = Deploy key only has read-only access. It is not same as personal account SSH keys.
settings.no_deploy_keys = You haven't added any deploy key.
settings.title = Title
settings.deploy_key_content = Content


+ 1
- 1
gogs.go View File

@@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)

const APP_VER = "0.7.22.1124 Beta"
const APP_VER = "0.7.22.1125 Beta"

func init() {
runtime.GOMAXPROCS(runtime.NumCPU())


+ 16
- 16
modules/bindata/bindata.go
File diff suppressed because it is too large
View File


+ 3
- 2
routers/api/v1/repo.go View File

@@ -189,7 +189,8 @@ func CreateOrgRepo(ctx *middleware.Context, opt api.CreateRepoOption) {

func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) {
ctxUser := ctx.User
// Not equal means current user is an organization.
// Not equal means context user is an organization,
// or is another user/organization if current user is admin.
if form.Uid != ctxUser.Id {
org, err := models.GetUserByID(form.Uid)
if err != nil {
@@ -208,7 +209,7 @@ func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) {
return
}

if ctxUser.IsOrganization() {
if ctxUser.IsOrganization() && !ctx.User.IsAdmin {
// Check ownership of organization.
if !ctxUser.IsOwnedBy(ctx.User.Id) {
ctx.APIError(403, "", "Given user is not owner of organization.")


+ 1
- 1
templates/.VERSION View File

@@ -1 +1 @@
0.7.22.1124 Beta
0.7.22.1125 Beta

+ 3
- 0
templates/repo/settings/deploy_keys.tmpl View File

@@ -53,6 +53,9 @@
<div class="ui attached segment">
<form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<div class="field">
{{.i18n.Tr "repo.settings.deploy_key_desc"}}
</div>
<div class="field {{if .Err_Title}}error{{end}}">
<label for="title">{{.i18n.Tr "repo.settings.title"}}</label>
<input id="title" name="title" value="{{.title}}" autofocus required>


Loading…
Cancel
Save