Skip to content

Commit 5bc3b86

Browse files
committed
restricted users only see repos in orgs witch there team was assigned to
1 parent 0c655c4 commit 5bc3b86

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

models/repo/repo_list.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -652,12 +652,12 @@ func AccessibleRepositoryCondition(user *user_model.User, unitType unit.Type) bu
652652
userOrgTeamUnitRepoCond("`repository`.id", user.ID, unitType),
653653
)
654654
}
655-
cond = cond.Or(
656-
// 4. Repositories that we directly own
657-
builder.Eq{"`repository`.owner_id": user.ID},
655+
// 4. Repositories that we directly own
656+
cond = cond.Or(builder.Eq{"`repository`.owner_id": user.ID})
657+
if !user.IsRestricted {
658658
// 5. Be able to see all public repos in private organizations that we are an org_user of
659-
userOrgPublicRepoCond(user.ID),
660-
)
659+
cond = cond.Or(userOrgPublicRepoCond(user.ID))
660+
}
661661
}
662662

663663
return cond

models/user/search.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ func BuildCanSeeUserCondition(actor *User) builder.Cond {
160160
// or private users who do follow them
161161
cond = cond.Or(builder.Eq{
162162
"`user`.visibility": structs.VisibleTypePrivate,
163-
"`user`.id": builder.Select("follow.user_id").From("follow").Where(builder.Eq{"follow.follow_id": actor.ID})})
163+
"`user`.id": builder.Select("follow.user_id").From("follow").Where(builder.Eq{"follow.follow_id": actor.ID}),
164+
})
164165
}
165166
// Don't forget about self
166167
return cond.Or(builder.Eq{"`user`.id": actor.ID})

0 commit comments

Comments
 (0)