mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-24 05:38:46 +00:00
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]>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user