Skip to content

Commit 5f4d1a4

Browse files
[models] update GetTeamRepositories to also return repositories accessible via group permissions
1 parent 7d13717 commit 5f4d1a4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

models/repo/org_repo.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ type SearchTeamRepoOptions struct {
3030
func GetTeamRepositories(ctx context.Context, opts *SearchTeamRepoOptions) (RepositoryList, error) {
3131
sess := db.GetEngine(ctx)
3232
if opts.TeamID > 0 {
33-
sess = sess.In("id",
34-
builder.Select("repo_id").
35-
From("team_repo").
36-
Where(builder.Eq{"team_id": opts.TeamID}),
33+
sess = sess.Where(
34+
builder.Or(
35+
builder.In("id", builder.Select("repo_id").
36+
From("team_repo").
37+
Where(builder.Eq{"team_id": opts.TeamID}),
38+
)),
39+
builder.In("id", ReposAccessibleByGroupTeamBuilder(opts.TeamID)),
3740
)
3841
}
3942
if opts.PageSize > 0 {

0 commit comments

Comments
 (0)