Skip to content

Commit 5ab3782

Browse files
authored
Restricted users only see repos in orgs which their team was assigned to (#28025)
--- *Sponsored by Kithara Software GmbH*
1 parent d4d05f9 commit 5ab3782

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
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

0 commit comments

Comments
 (0)