diff options
Diffstat (limited to 'services')
-rw-r--r-- | services/oauth2_provider/access_token.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/services/oauth2_provider/access_token.go b/services/oauth2_provider/access_token.go index 77ddce0534..5cb6fb64c5 100644 --- a/services/oauth2_provider/access_token.go +++ b/services/oauth2_provider/access_token.go @@ -241,14 +241,15 @@ func GetOAuthGroupsForUser(ctx context.Context, user *user_model.User, onlyPubli return nil, fmt.Errorf("GetUserOrgList: %w", err) } + orgTeams, err := org_model.OrgList(orgs).LoadTeams(ctx) + if err != nil { + return nil, fmt.Errorf("LoadTeams: %w", err) + } + var groups []string for _, org := range orgs { groups = append(groups, org.Name) - teams, err := org.LoadTeams(ctx) - if err != nil { - return nil, fmt.Errorf("LoadTeams: %w", err) - } - for _, team := range teams { + for _, team := range orgTeams[org.ID] { if team.IsMember(ctx, user.ID) { groups = append(groups, org.Name+":"+team.LowerName) } |