diff options
author | Matthias Beckert <beckert.matthias@googlemail.com> | 2019-04-11 10:32:42 +0200 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2019-04-11 16:32:42 +0800 |
commit | 5348573fdf88d2d9261ede567c137c151ae0d2e2 (patch) | |
tree | 65eaed05a21677a34a84bf9d2b458fefd1917c5c /routers/repo/setting.go | |
parent | 66fa092cc8a8e62f7b224b2d7ea67c764564f22f (diff) | |
download | gitea-5348573fdf88d2d9261ede567c137c151ae0d2e2.tar.gz gitea-5348573fdf88d2d9261ede567c137c151ae0d2e2.zip |
Allow admin users to set a repositoires visibility to public, even if FORCE_PRIVATE is to true (#6541) (#6572)
Signed-off-by: Matthias Beckert <beckert.matthias@googlemail.com>
Diffstat (limited to 'routers/repo/setting.go')
-rw-r--r-- | routers/repo/setting.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/repo/setting.go b/routers/repo/setting.go index c24cee3b21..0101b2362b 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -95,8 +95,8 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { } visibilityChanged := repo.IsPrivate != form.Private - // when ForcePrivate enabled, you could change public repo to private, but could not change private to public - if visibilityChanged && setting.Repository.ForcePrivate && !form.Private { + // when ForcePrivate enabled, you could change public repo to private, but only admin users can change private to public + if visibilityChanged && setting.Repository.ForcePrivate && !form.Private && !ctx.User.IsAdmin { ctx.ServerError("Force Private enabled", errors.New("cannot change private repository to public")) return } |