mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
c2e6e782a8
* add setup steps * refactoring * omitempty * cleanup * begin org * create org * setup org * setup org * merge * fixes * fixes * fixes * add project * add oidc application * fix app creation * add resourceOwner to writemodels * resource owner * cleanup * global org, iam project and iam member in setup * logs * logs * logs * cleanup * Update internal/v2/command/project.go Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com> * check project state * add org domain commands * add org status changes and member commands * fixes * policies * login policy * fix iam project event * mapper * label policy * change to command * fix * fix * handle change event differently and lot of fixes * idps * fixes * fixes * fixes * changedEvent handling * fix change events * remove creation date Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com>
70 lines
2.2 KiB
Go
70 lines
2.2 KiB
Go
package management
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/golang/protobuf/ptypes/empty"
|
|
|
|
"github.com/caos/zitadel/internal/api/authz"
|
|
"github.com/caos/zitadel/pkg/grpc/management"
|
|
)
|
|
|
|
func (s *Server) IdpByID(ctx context.Context, id *management.IdpID) (*management.IdpView, error) {
|
|
config, err := s.org.IDPConfigByID(ctx, id.Id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return idpViewFromModel(config), nil
|
|
}
|
|
|
|
func (s *Server) CreateOidcIdp(ctx context.Context, oidcIdpConfig *management.OidcIdpConfigCreate) (*management.Idp, error) {
|
|
config, err := s.command.AddIDPConfig(ctx, createOidcIdpToDomain(oidcIdpConfig))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return idpFromDomain(config), nil
|
|
}
|
|
|
|
func (s *Server) UpdateIdpConfig(ctx context.Context, idpConfig *management.IdpUpdate) (*management.Idp, error) {
|
|
config, err := s.command.ChangeIDPConfig(ctx, updateIdpToDomain(ctx, idpConfig))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return idpFromDomain(config), nil
|
|
}
|
|
|
|
func (s *Server) DeactivateIdpConfig(ctx context.Context, id *management.IdpID) (*empty.Empty, error) {
|
|
err := s.command.DeactivateIDPConfig(ctx, id.Id, authz.GetCtxData(ctx).OrgID)
|
|
return &empty.Empty{}, err
|
|
}
|
|
|
|
func (s *Server) ReactivateIdpConfig(ctx context.Context, id *management.IdpID) (*empty.Empty, error) {
|
|
err := s.command.ReactivateIDPConfig(ctx, id.Id, authz.GetCtxData(ctx).OrgID)
|
|
return &empty.Empty{}, err
|
|
}
|
|
|
|
func (s *Server) RemoveIdpConfig(ctx context.Context, id *management.IdpID) (*empty.Empty, error) {
|
|
err := s.command.RemoveIDPConfig(ctx, id.Id, authz.GetCtxData(ctx).OrgID)
|
|
return &empty.Empty{}, err
|
|
}
|
|
|
|
func (s *Server) UpdateOidcIdpConfig(ctx context.Context, request *management.OidcIdpConfigUpdate) (*management.OidcIdpConfig, error) {
|
|
config, err := s.command.ChangeIDPOIDCConfig(ctx, updateOidcIdpToDomain(ctx, request))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return oidcIdpConfigFromDomain(config), nil
|
|
}
|
|
|
|
func (s *Server) SearchIdps(ctx context.Context, request *management.IdpSearchRequest) (*management.IdpSearchResponse, error) {
|
|
searchRequest, err := idpConfigSearchRequestToModel(request)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
response, err := s.org.SearchIDPConfigs(ctx, searchRequest)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return idpConfigSearchResponseFromModel(response), nil
|
|
}
|