mirror of
https://github.com/andwati/zitadel.git
synced 2026-12-03 09:28:55 +00:00
fix: use domain models for v2 eventstore (#1151)
* fix: use domain models for v2 eventstore * fix: user domain model * Update internal/api/grpc/admin/login_policy_converter.go Co-authored-by: Livio Amstutz <[email protected]> * fix: converter Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
@@ -8,56 +8,57 @@ import (
|
||||
)
|
||||
|
||||
func (s *Server) IdpByID(ctx context.Context, id *admin.IdpID) (*admin.IdpView, error) {
|
||||
config, err := s.iam.IDPConfigByID(ctx, id.Id)
|
||||
config, err := s.query.DefaultIDPConfigByID(ctx, id.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return idpViewFromModel(config), nil
|
||||
return idpViewFromDomain(config), nil
|
||||
}
|
||||
|
||||
func (s *Server) CreateOidcIdp(ctx context.Context, oidcIdpConfig *admin.OidcIdpConfigCreate) (*admin.Idp, error) {
|
||||
config, err := s.iam.AddOIDCIDPConfig(ctx, createOidcIdpToModel(oidcIdpConfig))
|
||||
config, err := s.command.AddDefaultIDPConfig(ctx, createOIDCIDPToDomain(oidcIdpConfig))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return idpFromModel(config), nil
|
||||
return idpFromDomain(config), nil
|
||||
}
|
||||
|
||||
func (s *Server) UpdateIdpConfig(ctx context.Context, idpConfig *admin.IdpUpdate) (*admin.Idp, error) {
|
||||
config, err := s.iam.ChangeIDPConfig(ctx, updateIdpToModel(idpConfig))
|
||||
config, err := s.command.ChangeDefaultIDPConfig(ctx, updateIdpToDomain(idpConfig))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return idpFromModel(config), nil
|
||||
return idpFromDomain(config), nil
|
||||
}
|
||||
|
||||
func (s *Server) DeactivateIdpConfig(ctx context.Context, id *admin.IdpID) (*admin.Idp, error) {
|
||||
config, err := s.iam.DeactivateIDPConfig(ctx, id.Id)
|
||||
config, err := s.command.DeactivateDefaultIDPConfig(ctx, id.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return idpFromModel(config), nil
|
||||
return idpFromDomain(config), nil
|
||||
}
|
||||
|
||||
func (s *Server) ReactivateIdpConfig(ctx context.Context, id *admin.IdpID) (*admin.Idp, error) {
|
||||
config, err := s.iam.ReactivateIDPConfig(ctx, id.Id)
|
||||
config, err := s.command.ReactivateDefaultIDPConfig(ctx, id.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return idpFromModel(config), nil
|
||||
return idpFromDomain(config), nil
|
||||
}
|
||||
|
||||
//TODO: Change To V2
|
||||
func (s *Server) RemoveIdpConfig(ctx context.Context, id *admin.IdpID) (*empty.Empty, error) {
|
||||
err := s.iam.RemoveIDPConfig(ctx, id.Id)
|
||||
return &empty.Empty{}, err
|
||||
}
|
||||
|
||||
func (s *Server) UpdateOidcIdpConfig(ctx context.Context, request *admin.OidcIdpConfigUpdate) (*admin.OidcIdpConfig, error) {
|
||||
config, err := s.iam.ChangeOidcIDPConfig(ctx, updateOidcIdpToModel(request))
|
||||
config, err := s.command.ChangeDefaultIDPOIDCConfig(ctx, updateOIDCIDPToDomain(request))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return oidcIdpConfigFromModel(config), nil
|
||||
return oidcIDPConfigFromDomain(config), nil
|
||||
}
|
||||
|
||||
func (s *Server) SearchIdps(ctx context.Context, request *admin.IdpSearchRequest) (*admin.IdpSearchResponse, error) {
|
||||
|
||||
Reference in New Issue
Block a user