@@ -59,7 +59,7 @@ func HasTeamGroup(ctx context.Context, orgID, teamID, groupID int64) bool {
5959
6060// AddTeamGroup adds a group to a team
6161func AddTeamGroup (ctx context.Context , orgID , teamID , groupID int64 , access perm.AccessMode , canCreateIn bool ) error {
62- if access <= perm .AccessModeWrite {
62+ if access < perm .AccessModeWrite {
6363 canCreateIn = false
6464 }
6565 _ , err := db .GetEngine (ctx ).Insert (& RepoGroupTeam {
@@ -113,6 +113,15 @@ func FindGroupTeams(ctx context.Context, groupID int64) (gteams []*RepoGroupTeam
113113 Find (& gteams )
114114}
115115
116+ func FindUserGroupTeams (ctx context.Context , groupID int64 , userID int64 ) (gteams []* RepoGroupTeam , err error ) {
117+ return gteams , db .GetEngine (ctx ).
118+ Where ("group_id=?" , groupID ).
119+ And ("team_user.uid = ?" , userID ).
120+ Table ("repo_group_team" ).
121+ Join ("INNER" , "team_user" , "team_user.team_id = repo_group_team.team_id" ).
122+ Find (& gteams )
123+ }
124+
116125func FindGroupTeamByTeamID (ctx context.Context , groupID , teamID int64 ) (gteam * RepoGroupTeam , err error ) {
117126 gteam = new (RepoGroupTeam )
118127 has , err := db .GetEngine (ctx ).
0 commit comments