summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguillep2k <18600385+guillep2k@users.noreply.github.com>2020-05-22 23:12:20 -0300
committerGitHub <noreply@github.com>2020-05-22 22:12:20 -0400
commit3b1e114ede83177c29427bae5543f26e777ab1c0 (patch)
treecb74ad629f918b2b8ea01072ec5e4d54322e543b
parent573a9c62281c31da71adc36c70b2d50de5fd73c2 (diff)
downloadgitea-3b1e114ede83177c29427bae5543f26e777ab1c0.tar.gz
gitea-3b1e114ede83177c29427bae5543f26e777ab1c0.zip
Prevent transferring repos to invisible orgs (#11517) (#11549)
Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com> Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com> Co-authored-by: zeripath <art27@cantab.net>
-rw-r--r--routers/repo/setting.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index 7a2db88c1f..dff13ff5b3 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -22,6 +22,7 @@ import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/validation"
"code.gitea.io/gitea/routers/utils"
@@ -379,6 +380,14 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
return
}
+ if newOwner.Type == models.UserTypeOrganization {
+ if !ctx.User.IsAdmin && newOwner.Visibility == structs.VisibleTypePrivate && !ctx.User.IsUserPartOfOrg(newOwner.ID) {
+ // The user shouldn't know about this organization
+ ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_owner_name"), tplSettingsOptions, nil)
+ return
+ }
+ }
+
// Close the GitRepo if open
if ctx.Repo.GitRepo != nil {
ctx.Repo.GitRepo.Close()