Skip to content

feat(groups): Allow to list projects a group is member of#2248

Merged
javirln merged 11 commits into
chainloop-dev:mainfrom
javirln:feat/pfm-3311
Jul 11, 2025
Merged

feat(groups): Allow to list projects a group is member of#2248
javirln merged 11 commits into
chainloop-dev:mainfrom
javirln:feat/pfm-3311

Conversation

@javirln

@javirln javirln commented Jul 11, 2025

Copy link
Copy Markdown
Member

This patch introduces an endpoint to retrieve all projects a group is a member of. If a requester is provided, the results are filtered based on the projects the user has visibility into.

javirln added 4 commits July 11, 2025 14:33
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
@javirln javirln self-assigned this Jul 11, 2025
@javirln javirln requested review from Copilot, jiparis and migmartri and removed request for Copilot July 11, 2025 13:49
@javirln javirln marked this pull request as ready for review July 11, 2025 13:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a new paginated endpoint to list all projects a given group belongs to, optionally filtered by a requesting user’s visibility.

  • Introduce ListProjectsByGroup in the data layer to fetch group-project memberships and projects with latest version info.
  • Extend the business (biz) and service layers to wire up the use case, gRPC handler, proto definitions, and JSON schemas.
  • Update generated frontend types and wire setup to support the new RPC.

Reviewed Changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
app/controlplane/pkg/data/group.go New ListProjectsByGroup repo method with pagination, visibility filtering, and version joins
app/controlplane/pkg/biz/group.go Extended GroupRepo and GroupUseCase with ListProjectsByGroup
app/controlplane/internal/service/group.go Added ListProjects gRPC handler and mapping to protobuf
app/controlplane/api/controlplane/v1/group.proto Defined new ListProjects RPC and messages (ProjectInfo)
app/controlplane/api/gen/frontend/controlplane/v1/group.ts Frontend client types for request, response, and ProjectInfo
Comments suppressed due to low confidence (1)

app/controlplane/pkg/data/group.go:581

  • There are no existing tests covering the new ListProjectsByGroup functionality. Consider adding unit tests for both the repository method and the GroupUseCase.ListProjectsByGroup to validate filtering, pagination, and visibility logic.
func (g GroupRepo) ListProjectsByGroup(ctx context.Context, orgID uuid.UUID, groupID uuid.UUID, visibleProjectIDs []uuid.UUID, paginationOpts *pagination.OffsetPaginationOpts) ([]*biz.GroupProjectInfo, int, error) {

Comment thread app/controlplane/pkg/data/group.go
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Comment thread app/controlplane/api/controlplane/v1/group.proto Outdated
Comment thread app/controlplane/internal/service/group.go Outdated
Comment thread app/controlplane/pkg/biz/group.go Outdated

@migmartri migmartri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S

Comment thread app/controlplane/api/controlplane/v1/project.proto
Comment thread app/controlplane/internal/service/group.go
Comment thread app/controlplane/pkg/authz/authz.go Outdated
// Group Memberships
"/controlplane.v1.GroupService/ListMembers": {PolicyGroupListMemberships},
"/controlplane.v1.GroupService/ListMembers": {PolicyGroupListMemberships},
"/controlplane.v1.GroupService/ListProjects": {PolicyGroupListMemberships},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this permission correct? Sholdn't we add a new one and assign it properly?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure. Keep in mind this is just for the middleware to allow the call. Since visible projects are filtered already at the service level, we might not need another permission.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created another one just for the sake of having it separated but I don't think we need it

Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Comment thread app/controlplane/pkg/data/group.go Outdated
javirln added 3 commits July 11, 2025 16:20
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Comment thread app/controlplane/pkg/data/group.go Outdated
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Comment thread app/controlplane/internal/service/group.go Outdated
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
@javirln javirln merged commit 169d2bb into chainloop-dev:main Jul 11, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants