mirror of
https://github.com/go-gitea/gitea.git
synced 2025-01-03 14:57:55 -05:00
Use an array of VisibleType
for filtering
This commit is contained in:
parent
ee2f31f32b
commit
eeecdab5db
@ -321,9 +321,9 @@ func accessibleRepositoryCondition(user *User) builder.Cond {
|
|||||||
var cond = builder.NewCond()
|
var cond = builder.NewCond()
|
||||||
|
|
||||||
if user == nil || !user.IsRestricted {
|
if user == nil || !user.IsRestricted {
|
||||||
var orgVisibilityLimit = structs.VisibleTypePrivate
|
orgVisibilityLimit := []structs.VisibleType{structs.VisibleTypePrivate}
|
||||||
if user == nil {
|
if user == nil {
|
||||||
orgVisibilityLimit = structs.VisibleTypeLimited
|
orgVisibilityLimit = append(orgVisibilityLimit, structs.VisibleTypeLimited)
|
||||||
}
|
}
|
||||||
// 1. Be able to see all non-private repositories that either:
|
// 1. Be able to see all non-private repositories that either:
|
||||||
cond = cond.Or(builder.And(
|
cond = cond.Or(builder.And(
|
||||||
@ -332,7 +332,7 @@ func accessibleRepositoryCondition(user *User) builder.Cond {
|
|||||||
// A. Aren't in organisations __OR__
|
// A. Aren't in organisations __OR__
|
||||||
builder.NotIn("`repository`.owner_id", builder.Select("id").From("`user`").Where(builder.Eq{"type": UserTypeOrganization})),
|
builder.NotIn("`repository`.owner_id", builder.Select("id").From("`user`").Where(builder.Eq{"type": UserTypeOrganization})),
|
||||||
// B. Isn't a private organisation. Limited is OK as long as we're logged in.
|
// B. Isn't a private organisation. Limited is OK as long as we're logged in.
|
||||||
builder.NotIn("`repository`.owner_id", builder.Select("id").From("`user`").Where(builder.Gte{"visibility": orgVisibilityLimit})))))
|
builder.NotIn("`repository`.owner_id", builder.Select("id").From("`user`").Where(builder.In("visibility", orgVisibilityLimit))))))
|
||||||
}
|
}
|
||||||
|
|
||||||
if user != nil {
|
if user != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user