Browse Source

allow admin to migrate for any user/org

Unknwon 9 years ago
parent
commit
144663a3cf

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

@@ -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

@@ -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())

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


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

@@ -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

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

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

@@ -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>

Some files were not shown because too many files changed in this diff