0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-04 16:46:17 +02:00

[models] update GetTeamRepositories to also return repositories accessible via group permissions

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2025-01-09 19:10:51 -05:00
parent e2f5ca92ac
commit 4ef0a905de
No known key found for this signature in database
GPG Key ID: 924A5F6AF051E87C

View File

@ -30,10 +30,13 @@ type SearchTeamRepoOptions struct {
func GetTeamRepositories(ctx context.Context, opts *SearchTeamRepoOptions) (RepositoryList, error) {
sess := db.GetEngine(ctx)
if opts.TeamID > 0 {
sess = sess.In("id",
builder.Select("repo_id").
From("team_repo").
Where(builder.Eq{"team_id": opts.TeamID}),
sess = sess.Where(
builder.Or(
builder.In("id", builder.Select("repo_id").
From("team_repo").
Where(builder.Eq{"team_id": opts.TeamID}),
)),
builder.In("id", ReposAccessibleByGroupTeamBuilder(opts.TeamID)),
)
}
if opts.PageSize > 0 {