mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-29 09:17:41 +01:00
allow admin to migrate for any user/org
This commit is contained in:
parent
ba92f4687e
commit
144663a3cf
6 changed files with 25 additions and 20 deletions
|
@ -612,6 +612,7 @@ settings.slack_domain = Domain
|
||||||
settings.slack_channel = Channel
|
settings.slack_channel = Channel
|
||||||
settings.deploy_keys = Deploy Keys
|
settings.deploy_keys = Deploy Keys
|
||||||
settings.add_deploy_key = Add Deploy Key
|
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.no_deploy_keys = You haven't added any deploy key.
|
||||||
settings.title = Title
|
settings.title = Title
|
||||||
settings.deploy_key_content = Content
|
settings.deploy_key_content = Content
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.7.22.1124 Beta"
|
const APP_VER = "0.7.22.1125 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -189,7 +189,8 @@ func CreateOrgRepo(ctx *middleware.Context, opt api.CreateRepoOption) {
|
||||||
|
|
||||||
func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
||||||
ctxUser := ctx.User
|
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 {
|
if form.Uid != ctxUser.Id {
|
||||||
org, err := models.GetUserByID(form.Uid)
|
org, err := models.GetUserByID(form.Uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -208,7 +209,7 @@ func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctxUser.IsOrganization() {
|
if ctxUser.IsOrganization() && !ctx.User.IsAdmin {
|
||||||
// Check ownership of organization.
|
// Check ownership of organization.
|
||||||
if !ctxUser.IsOwnedBy(ctx.User.Id) {
|
if !ctxUser.IsOwnedBy(ctx.User.Id) {
|
||||||
ctx.APIError(403, "", "Given user is not owner of organization.")
|
ctx.APIError(403, "", "Given user is not owner of organization.")
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.7.22.1124 Beta
|
0.7.22.1125 Beta
|
|
@ -53,6 +53,9 @@
|
||||||
<div class="ui attached segment">
|
<div class="ui attached segment">
|
||||||
<form class="ui form" action="{{.Link}}" method="post">
|
<form class="ui form" action="{{.Link}}" method="post">
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
|
<div class="field">
|
||||||
|
{{.i18n.Tr "repo.settings.deploy_key_desc"}}
|
||||||
|
</div>
|
||||||
<div class="field {{if .Err_Title}}error{{end}}">
|
<div class="field {{if .Err_Title}}error{{end}}">
|
||||||
<label for="title">{{.i18n.Tr "repo.settings.title"}}</label>
|
<label for="title">{{.i18n.Tr "repo.settings.title"}}</label>
|
||||||
<input id="title" name="title" value="{{.title}}" autofocus required>
|
<input id="title" name="title" value="{{.title}}" autofocus required>
|
||||||
|
|
Loading…
Reference in a new issue