Skip to content

Commit

Permalink
no builder for now
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 committed Oct 11, 2024
1 parent db511aa commit 4f38f65
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions models/organization/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,19 +658,12 @@ func (org *Organization) getUserTeamIDs(ctx context.Context, userID int64) ([]in
return teamIDs, db.GetEngine(ctx).
Table("team").
Cols("team.id").
Where(builder.In("team.id", userTeamIDbuilder(org.ID, userID))).
Where("`team_user`.org_id = ?", org.ID).
Join("INNER", "team_user", "`team_user`.team_id = team.id").
And("`team_user`.uid = ?", userID).
Find(&teamIDs)
}

func userTeamIDbuilder(orgID, userID int64) *builder.Builder {
return builder.Select("team.id").From("team").
InnerJoin("team_user", "team_user.team_id = team.id").
Where(builder.Eq{
"team_user.org_id": orgID,
"team_user.uid": userID,
})
}

// TeamsWithAccessToRepo returns all teams that have given access level to the repository.
func (org *Organization) TeamsWithAccessToRepo(ctx context.Context, repoID int64, mode perm.AccessMode) ([]*Team, error) {
return GetTeamsWithAccessToRepo(ctx, org.ID, repoID, mode)
Expand Down

0 comments on commit 4f38f65

Please sign in to comment.