2020-03-24 09:14:39 +00:00
|
|
|
package grpc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2020-05-13 12:22:29 +00:00
|
|
|
|
2020-03-24 09:14:39 +00:00
|
|
|
"github.com/caos/zitadel/internal/errors"
|
|
|
|
)
|
|
|
|
|
2020-05-13 12:22:29 +00:00
|
|
|
func (s *Server) GetOrgByID(ctx context.Context, orgID *OrgID) (*Org, error) {
|
|
|
|
org, err := s.org.OrgByID(ctx, orgID.Id)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return orgFromModel(org), nil
|
2020-03-24 09:14:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) GetOrgByDomainGlobal(ctx context.Context, in *OrgDomain) (*Org, error) {
|
2020-05-13 12:22:29 +00:00
|
|
|
org, err := s.org.OrgByDomainGlobal(ctx, in.Domain)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2020-05-26 14:46:16 +00:00
|
|
|
return orgFromView(org), nil
|
2020-03-24 09:14:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) DeactivateOrg(ctx context.Context, in *OrgID) (*Org, error) {
|
2020-05-13 12:22:29 +00:00
|
|
|
org, err := s.org.DeactivateOrg(ctx, in.Id)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return orgFromModel(org), nil
|
2020-03-24 09:14:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) ReactivateOrg(ctx context.Context, in *OrgID) (*Org, error) {
|
2020-05-13 12:22:29 +00:00
|
|
|
org, err := s.org.ReactivateOrg(ctx, in.Id)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return orgFromModel(org), nil
|
2020-03-24 09:14:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) OrgChanges(ctx context.Context, changesRequest *ChangeRequest) (*Changes, error) {
|
2020-05-13 12:22:29 +00:00
|
|
|
return nil, errors.ThrowUnimplemented(nil, "GRPC-DNiIq", "unimplemented")
|
2020-03-24 09:14:39 +00:00
|
|
|
}
|