Files
zitadel/backend/v3/api/session/v2/convert/session_check_user.go
T
8b90ddb0b5 feat(session): User Check API with relation tables (#11777)
# Which Problems Are Solved

As part of #11035 , this PR implements the user check logic for session
validation

# How the Problems Are Solved

- Add user and session repositories as invoke options, as well as their
mocks to prepare the ground for testing
- Implement the logic for the UserCheck command, following what has been
done on eventstore side
- Add a session permission chek interface to be used during the
`Validate()` part of the Commander

# Additional Context

This is a cherry-picked PR + minor changes, coming from
https://github.com/zitadel/zitadel/pull/11164
- Relates to #11035

---------

Co-authored-by: Silvan <[email protected]>
2026-03-10 09:10:31 +00:00

26 lines
780 B
Go

package convert
import (
"github.com/zitadel/zitadel/backend/v3/domain"
"github.com/zitadel/zitadel/internal/zerrors"
session_grpc "github.com/zitadel/zitadel/pkg/grpc/session/v2"
)
func CheckUserGRPCToQueryOpt(checkUser *session_grpc.CheckUser) (*domain.CheckUserType, error) {
var toReturn *domain.CheckUserType
if checkUser == nil {
return toReturn, nil
}
switch searchType := checkUser.GetSearch().(type) {
case *session_grpc.CheckUser_UserId:
toReturn = &domain.CheckUserType{UserID: searchType.UserId}
case *session_grpc.CheckUser_LoginName:
toReturn = &domain.CheckUserType{LoginName: searchType.LoginName}
default:
return nil, zerrors.ThrowInvalidArgumentf(nil, "CONV-7B2m0b", "user search %T not implemented", searchType)
}
return toReturn, nil
}