mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-01 20:25:22 +02:00
rename tables in group-related query conditions
This commit is contained in:
@@ -11,10 +11,10 @@ import (
|
||||
|
||||
func GetTeamsWithAccessToGroup(ctx context.Context, orgID, groupID int64, mode perm.AccessMode) ([]*Team, error) {
|
||||
teams := make([]*Team, 0)
|
||||
inCond := group_model.ParentGroupCond(ctx, "group_team.group_id", groupID)
|
||||
return teams, db.GetEngine(ctx).Distinct("team.*").Where("group_team.access_mode >= ?", mode).
|
||||
Join("INNER", "group_team", "group_team.team_id = team.id and group_team.org_id = ?", orgID).
|
||||
And("group_team.org_id = ?", orgID).
|
||||
inCond := group_model.ParentGroupCond(ctx, "repo_group_team.group_id", groupID)
|
||||
return teams, db.GetEngine(ctx).Distinct("team.*").Where("repo_group_team.access_mode >= ?", mode).
|
||||
Join("INNER", "repo_group_team", "repo_group_team.team_id = team.id and repo_group_team.org_id = ?", orgID).
|
||||
And("repo_group_team.org_id = ?", orgID).
|
||||
And(inCond).
|
||||
OrderBy("name").
|
||||
Find(&teams)
|
||||
@@ -22,13 +22,13 @@ func GetTeamsWithAccessToGroup(ctx context.Context, orgID, groupID int64, mode p
|
||||
|
||||
func GetTeamsWithAccessToGroupUnit(ctx context.Context, orgID, groupID int64, mode perm.AccessMode, unitType unit.Type) ([]*Team, error) {
|
||||
teams := make([]*Team, 0)
|
||||
inCond := group_model.ParentGroupCond(ctx, "group_team.group_id", groupID)
|
||||
return teams, db.GetEngine(ctx).Where("group_team.access_mode >= ?", mode).
|
||||
Join("INNER", "group_team", "group_team.team_id = team.id").
|
||||
Join("INNER", "group_unit", "group_unit.team_id = team.id").
|
||||
And("group_team.org_id = ?", orgID).
|
||||
inCond := group_model.ParentGroupCond(ctx, "repo_group_team.group_id", groupID)
|
||||
return teams, db.GetEngine(ctx).Where("repo_group_team.access_mode >= ?", mode).
|
||||
Join("INNER", "repo_group_team", "repo_group_team.team_id = team.id").
|
||||
Join("INNER", "repo_group_unit", "repo_group_unit.team_id = team.id").
|
||||
And("repo_group_team.org_id = ?", orgID).
|
||||
And(inCond).
|
||||
And("group_unit.type = ?", unitType).
|
||||
And("repo_group_unit.type = ?", unitType).
|
||||
OrderBy("name").
|
||||
Find(&teams)
|
||||
}
|
||||
|
||||
@@ -129,8 +129,8 @@ func GetUserRepoTeams(ctx context.Context, orgID, userID, repoID int64) (teams T
|
||||
// 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").
|
||||
Where("`repo_group_team`.group_id = ?", groupID).
|
||||
Join("INNER", "repo_group_team", "`repo_group_team`.team_id = `team`.id").
|
||||
Join("INNER", "team_user", "`team_user`.team_id = `team`.id").
|
||||
And("`team_user`.uid = ?", userID).
|
||||
Asc("`team`.name").
|
||||
|
||||
Reference in New Issue
Block a user