|
|
@ -353,11 +353,12 @@ func accessibleRepositoryCondition(user *User) builder.Cond { |
|
|
|
// 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( |
|
|
|
builder.Eq{"`repository`.is_private": false}, |
|
|
|
builder.Eq{"`repository`.is_private": false}, |
|
|
|
builder.Or( |
|
|
|
// 2. Aren't in an private organisation or limited organisation if we're not logged in
|
|
|
|
// A. Aren't in organisations __OR__
|
|
|
|
builder.NotIn("`repository`.owner_id", builder.Select("id").From("`user`").Where( |
|
|
|
builder.NotIn("`repository`.owner_id", builder.Select("id").From("`user`").Where(builder.Eq{"type": UserTypeOrganization})), |
|
|
|
builder.And( |
|
|
|
// B. Isn't a private organisation. Limited is OK as long as we're logged in.
|
|
|
|
builder.Eq{"type": UserTypeOrganization}, |
|
|
|
builder.NotIn("`repository`.owner_id", builder.Select("id").From("`user`").Where(builder.In("visibility", orgVisibilityLimit)))))) |
|
|
|
builder.In("visibility", orgVisibilityLimit)), |
|
|
|
|
|
|
|
)))) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if user != nil { |
|
|
|
if user != nil { |
|
|
|