zitadel/pkg/management/api/grpc/org.go
Silvan 3025ac577b
feat: org queries (#136)
* search orgs

* org by domain

* member spooler

* member

* get roles

* tests

* types duration

* use default func for renew

* correct database

* reorder migrations

* delete unused consts

* move get roles to internal

* use prepared org by domain

* implement org in other objects

* add eventstores
2020-05-26 16:46:16 +02:00

44 lines
1.0 KiB
Go

package grpc
import (
"context"
"github.com/caos/zitadel/internal/errors"
)
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
}
func (s *Server) GetOrgByDomainGlobal(ctx context.Context, in *OrgDomain) (*Org, error) {
org, err := s.org.OrgByDomainGlobal(ctx, in.Domain)
if err != nil {
return nil, err
}
return orgFromView(org), nil
}
func (s *Server) DeactivateOrg(ctx context.Context, in *OrgID) (*Org, error) {
org, err := s.org.DeactivateOrg(ctx, in.Id)
if err != nil {
return nil, err
}
return orgFromModel(org), nil
}
func (s *Server) ReactivateOrg(ctx context.Context, in *OrgID) (*Org, error) {
org, err := s.org.ReactivateOrg(ctx, in.Id)
if err != nil {
return nil, err
}
return orgFromModel(org), nil
}
func (s *Server) OrgChanges(ctx context.Context, changesRequest *ChangeRequest) (*Changes, error) {
return nil, errors.ThrowUnimplemented(nil, "GRPC-DNiIq", "unimplemented")
}