@@ -11,24 +11,24 @@ import (
1111
1212func  GetTeamsWithAccessToGroup (ctx  context.Context , orgID , groupID  int64 , mode  perm.AccessMode ) ([]* Team , error ) {
1313	teams  :=  make ([]* Team , 0 )
14- 	inCond  :=  group_model .ParentGroupCond (ctx , "group_team .group_id" , groupID )
15- 	return  teams , db .GetEngine (ctx ).Distinct ("team.*" ).Where ("group_team .access_mode >= ?" , mode ).
16- 		Join ("INNER" , "group_team " , "group_team .team_id = team.id and group_team .org_id = ?" , orgID ).
17- 		And ("group_team .org_id = ?" , orgID ).
14+ 	inCond  :=  group_model .ParentGroupCond (ctx , "repo_group_team .group_id" , groupID )
15+ 	return  teams , db .GetEngine (ctx ).Distinct ("team.*" ).Where ("repo_group_team .access_mode >= ?" , mode ).
16+ 		Join ("INNER" , "repo_group_team " , "repo_group_team .team_id = team.id and repo_group_team .org_id = ?" , orgID ).
17+ 		And ("repo_group_team .org_id = ?" , orgID ).
1818		And (inCond ).
1919		OrderBy ("name" ).
2020		Find (& teams )
2121}
2222
2323func  GetTeamsWithAccessToGroupUnit (ctx  context.Context , orgID , groupID  int64 , mode  perm.AccessMode , unitType  unit.Type ) ([]* Team , error ) {
2424	teams  :=  make ([]* Team , 0 )
25- 	inCond  :=  group_model .ParentGroupCond (ctx , "group_team .group_id" , groupID )
26- 	return  teams , db .GetEngine (ctx ).Where ("group_team .access_mode >= ?" , mode ).
27- 		Join ("INNER" , "group_team " , "group_team .team_id = team.id" ).
28- 		Join ("INNER" , "group_unit " , "group_unit .team_id = team.id" ).
29- 		And ("group_team .org_id = ?" , orgID ).
25+ 	inCond  :=  group_model .ParentGroupCond (ctx , "repo_group_team .group_id" , groupID )
26+ 	return  teams , db .GetEngine (ctx ).Where ("repo_group_team .access_mode >= ?" , mode ).
27+ 		Join ("INNER" , "repo_group_team " , "repo_group_team .team_id = team.id" ).
28+ 		Join ("INNER" , "repo_group_unit " , "repo_group_unit .team_id = team.id" ).
29+ 		And ("repo_group_team .org_id = ?" , orgID ).
3030		And (inCond ).
31- 		And ("group_unit .type = ?" , unitType ).
31+ 		And ("repo_group_unit .type = ?" , unitType ).
3232		OrderBy ("name" ).
3333		Find (& teams )
3434}
0 commit comments