1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

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>
This commit is contained in:
Matthias Beckert
2019-04-11 10:32:42 +02:00
committed by Lunny Xiao
parent 66fa092cc8
commit 5348573fdf
2 changed files with 6 additions and 2 deletions

View File

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