feat(groups): Allow to list projects a group is member of#2248
Conversation
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>
There was a problem hiding this comment.
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
ListProjectsByGroupin 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
ListProjectsByGroupfunctionality. Consider adding unit tests for both the repository method and theGroupUseCase.ListProjectsByGroupto 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) {
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
| // Group Memberships | ||
| "/controlplane.v1.GroupService/ListMembers": {PolicyGroupListMemberships}, | ||
| "/controlplane.v1.GroupService/ListMembers": {PolicyGroupListMemberships}, | ||
| "/controlplane.v1.GroupService/ListProjects": {PolicyGroupListMemberships}, |
There was a problem hiding this comment.
is this permission correct? Sholdn't we add a new one and assign it properly?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
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>
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.