Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect REQUIRE_SIGNIN_VIEW for packages #20873

Merged
merged 8 commits into from
Sep 21, 2022
5 changes: 3 additions & 2 deletions modules/context/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"code.gitea.io/gitea/models/perm"
"code.gitea.io/gitea/models/unit"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
)

Expand Down Expand Up @@ -79,7 +80,7 @@ func packageAssignment(ctx *Context, errCb func(int, string, interface{})) {
}
}
// 2. If authorize level is none, check if org is visible to user
if ctx.Package.AccessMode == perm.AccessModeNone && organization.HasOrgOrUserVisible(ctx, ctx.Package.Owner, ctx.Doer) {
if ctx.Package.AccessMode == perm.AccessModeNone && organization.HasOrgOrUserVisible(ctx, ctx.Package.Owner, ctx.Doer) && !setting.Service.RequireSignInView {
ctx.Package.AccessMode = perm.AccessModeRead
}
} else {
KN4CK3R marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -90,7 +91,7 @@ func packageAssignment(ctx *Context, errCb func(int, string, interface{})) {
} else if ctx.Package.Owner.Visibility == structs.VisibleTypePublic || ctx.Package.Owner.Visibility == structs.VisibleTypeLimited { // 2. Check if package owner is public or limited
ctx.Package.AccessMode = perm.AccessModeRead
}
} else if ctx.Package.Owner.Visibility == structs.VisibleTypePublic { // 3. Check if package owner is public
} else if ctx.Package.Owner.Visibility == structs.VisibleTypePublic && !setting.Service.RequireSignInView { // 3. Check if package owner is public
ctx.Package.AccessMode = perm.AccessModeRead
}
}
Expand Down