mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-09 07:47:34 +02:00
update team_list.go
add `GetUserGroupTeams` function
This commit is contained in:
parent
4690164a3f
commit
a8da652180
@ -126,6 +126,18 @@ func GetUserRepoTeams(ctx context.Context, orgID, userID, repoID int64) (teams T
|
||||
Find(&teams)
|
||||
}
|
||||
|
||||
// GetUserGroupTeams returns teams in a group that a user has access to
|
||||
func GetUserGroupTeams(ctx context.Context, groupID, userID int64) (teams TeamList, err error) {
|
||||
err = db.GetEngine(ctx).
|
||||
Where("`group_team`.group_id = ?", groupID).
|
||||
Join("INNER", "group_team", "`group_team`.team_id = `team`.id").
|
||||
Join("INNER", "team_user", "`team_user`.team_id = `team`.id").
|
||||
And("`team_user`.uid = ?", userID).
|
||||
Asc("`team`.name").
|
||||
Find(&teams)
|
||||
return
|
||||
}
|
||||
|
||||
func GetTeamsByOrgIDs(ctx context.Context, orgIDs []int64) (TeamList, error) {
|
||||
teams := make([]*Team, 0, 10)
|
||||
return teams, db.GetEngine(ctx).Where(builder.In("org_id", orgIDs)).Find(&teams)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user