Fix#20863
When REQUIRE_SIGNIN_VIEW = true, even with public repositories, you can only see them after you login. The packages should not be accessed without login.
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
if accessMode ==perm.AccessModeNone&&organization.HasOrgOrUserVisible(ctx,ctx.Package.Owner,ctx.Doer){
ctx.Package.AccessMode=perm.AccessModeRead
accessMode =perm.AccessModeRead
}
}
}else{
}else{
ifctx.Doer!=nil&&!ctx.Doer.IsGhost(){
ifctx.Doer!=nil&&!ctx.Doer.IsGhost(){
// 1. Check if user is package owner
// 1. Check if user is package owner
ifctx.Doer.ID==ctx.Package.Owner.ID{
ifctx.Doer.ID==ctx.Package.Owner.ID{
ctx.Package.AccessMode=perm.AccessModeOwner
accessMode =perm.AccessModeOwner
}elseifctx.Package.Owner.Visibility==structs.VisibleTypePublic||ctx.Package.Owner.Visibility==structs.VisibleTypeLimited{// 2. Check if package owner is public or limited
}elseifctx.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
accessMode =perm.AccessModeRead
}
}
}elseifctx.Package.Owner.Visibility==structs.VisibleTypePublic{// 3. Check if package owner is public
}elseifctx.Package.Owner.Visibility==structs.VisibleTypePublic{// 3. Check if package owner is public