mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 04:18:01 +00:00
7a6ca24625
* check uniqueness on create and register user * change user email, reserve release unique email * usergrant unique aggregate * usergrant uniqueness * validate UserGrant * fix tests * domain is set on username in all orgs * domain in admin * org domain sql * zitadel domain org name * org domains * org iam policy * default org iam policy * SETUP * load login names * login by login name * login name * fix: merge master * fix: merge master * Update internal/user/repository/eventsourcing/user.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * fix: fix unique domains * fix: rename env variable Co-authored-by: adlerhurst <silvan.reusser@gmail.com> Co-authored-by: Livio Amstutz <livio.a@gmail.com>
68 lines
1.9 KiB
Go
68 lines
1.9 KiB
Go
package grpc
|
|
|
|
import (
|
|
"context"
|
|
"github.com/golang/protobuf/ptypes/empty"
|
|
)
|
|
|
|
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 orgFromModel(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) SearchMyOrgDomains(ctx context.Context, in *OrgDomainSearchRequest) (*OrgDomainSearchResponse, error) {
|
|
domains, err := s.org.SearchMyOrgDomains(ctx, orgDomainSearchRequestToModel(in))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return orgDomainSearchResponseFromModel(domains), nil
|
|
}
|
|
|
|
func (s *Server) AddMyOrgDomain(ctx context.Context, in *AddOrgDomainRequest) (*OrgDomain, error) {
|
|
domain, err := s.org.AddMyOrgDomain(ctx, addOrgDomainToModel(in))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return orgDomainFromModel(domain), nil
|
|
}
|
|
|
|
func (s *Server) RemoveMyOrgDomain(ctx context.Context, in *RemoveOrgDomainRequest) (*empty.Empty, error) {
|
|
err := s.org.RemoveMyOrgDomain(ctx, in.Domain)
|
|
return &empty.Empty{}, err
|
|
}
|
|
|
|
func (s *Server) OrgChanges(ctx context.Context, changesRequest *ChangeRequest) (*Changes, error) {
|
|
response, err := s.org.OrgChanges(ctx, changesRequest.Id, 0, 0)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return orgChangesToResponse(response, changesRequest.GetSequenceOffset(), changesRequest.GetLimit()), nil
|
|
}
|