Skip to content

Commit 8ff03ec

Browse files
committed
some sketch changes
1 parent e434113 commit 8ff03ec

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

internal/core/integrations/gitlabint/gitlab_integration.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ func (g *GitlabIntegration) ListGroups(ctx core.Context, userID string, provider
336336
}
337337
// get the groups for this user
338338
groups, _, err := gitlabClient.ListGroups(ctx.Request().Context(), &gitlab.ListGroupsOptions{
339-
MinAccessLevel: utils.Ptr(gitlab.ReporterPermissions), // only list groups where the user has at least owner permissions
339+
ListOptions: gitlab.ListOptions{PerPage: 100}, // only list groups where the user has at least owner permissions
340340
})
341341

342342
if err != nil {
@@ -451,7 +451,7 @@ func (g *GitlabIntegration) GetRoleInGroup(ctx context.Context, userID string, p
451451
member, _, err := gitlabClient.GetMemberInGroup(ctx, token.GitLabUserID, groupIDInt)
452452
if err != nil {
453453
slog.Error("failed to get member in group", "err", err)
454-
if strings.Contains(err.Error(), "404 Not Found") {
454+
if strings.Contains(err.Error(), "404 Not Found") || strings.Contains(err.Error(), "403 Forbidden") {
455455
// user is not a member of the group
456456
return "", nil
457457
}

internal/core/integrations/thirdparty_integration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ func (t *thirdPartyIntegrations) GetRoleInGroup(ctx context.Context, userID stri
102102
return role, nil
103103
}
104104
}
105+
//when we are part of a subgroup we also have some basic access level to see the parent groups but we have no permissions to fetch the members of those groups
105106
return "", fmt.Errorf("no role found for user %s in org %s with providerID %s", userID, groupID, providerID)
106107
}
107108

0 commit comments

Comments
 (0)