feat: ListSessions to relational (#11987)

# Which Problems Are Solved

This PR introduces the possibility of using the relational DB when
calling the ListSession gRPC endpoint.

# How the Problems Are Solved

  - Implement the Querier interface for ListSession:
- Create a `domain` model for the Session object to be able to map the
gRPC session into it.
- Match the permission filters on ES side to be sure the same sessions
are returned
- Implement converter methods to go from `gRPC` to `domain` models (both
ways)
- Fix the session sql relational migration: rework the trigger to update
the `expiration` field to perform the update only when the input
`lifetime` has a non-zero value.
  - Link the Querier implementation with the gRPC endpoint
- Run the same integration tests against the relational DB, making sure
the outcome is the same. ⚠️ Due to missing permission checks, some
divergence is expected. Hence, specific code to circumvent the
differences has been put in place

# Additional Context

- Closes #11039
This commit is contained in:
Marco A.
2026-04-16 10:58:17 +02:00
committed by GitHub
parent 177589a0a8
commit 14acc60edd
15 changed files with 1912 additions and 294 deletions
+4
View File
@@ -8,6 +8,7 @@ import (
"github.com/muhlemmer/gu"
"google.golang.org/protobuf/types/known/timestamppb"
sessionv2 "github.com/zitadel/zitadel/backend/v3/api/session/v2"
"github.com/zitadel/zitadel/internal/api/authz"
"github.com/zitadel/zitadel/internal/api/grpc/object/v2"
"github.com/zitadel/zitadel/internal/domain"
@@ -38,6 +39,9 @@ func (s *Server) GetSession(ctx context.Context, req *connect.Request[session.Ge
}
func (s *Server) ListSessions(ctx context.Context, req *connect.Request[session.ListSessionsRequest]) (*connect.Response[session.ListSessionsResponse], error) {
if authz.GetFeatures(ctx).EnableRelationalTables {
return sessionv2.ListSessions(ctx, req)
}
queries, err := listSessionsRequestToQuery(ctx, req.Msg)
if err != nil {
return nil, err