mirror of
https://github.com/go-gitea/gitea.git
synced 2025-02-02 15:09:33 -05:00
Merge branch 'refactor-of-32211' into limit-org-member-view-of-restricted-users
This commit is contained in:
commit
a993136c23
@ -672,19 +672,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", getUserTeamIDsQueryBuilder(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 getUserTeamIDsQueryBuilder(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)
|
||||
|
Loading…
Reference in New Issue
Block a user