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
@@ -33,11 +33,17 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER set_expiration
BEFORE INSERT OR UPDATE OF lifetime ON zitadel.sessions
CREATE TRIGGER set_expiration_on_update
BEFORE UPDATE OF lifetime ON zitadel.sessions
FOR EACH ROW
EXECUTE FUNCTION zitadel.update_expiration();
CREATE TRIGGER set_expiration_on_insert
BEFORE INSERT ON zitadel.sessions
FOR EACH ROW
WHEN (NEW.lifetime <> '0'::interval)
EXECUTE FUNCTION zitadel.update_expiration();
CREATE TYPE zitadel.session_factor_type AS ENUM (
'user',
'password',