mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-21 23:37:31 +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>
71 lines
2.1 KiB
Go
71 lines
2.1 KiB
Go
package grpc
|
|
|
|
import (
|
|
"context"
|
|
"github.com/golang/protobuf/ptypes/empty"
|
|
)
|
|
|
|
func (s *Server) GetOrgByID(ctx context.Context, orgID *OrgID) (_ *Org, err error) {
|
|
org, err := s.org.OrgByID(ctx, orgID.Id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return orgFromModel(org), nil
|
|
}
|
|
|
|
func (s *Server) SearchOrgs(ctx context.Context, request *OrgSearchRequest) (_ *OrgSearchResponse, err error) {
|
|
result, err := s.org.SearchOrgs(ctx, orgSearchRequestToModel(request))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &OrgSearchResponse{
|
|
Result: orgViewsFromModel(result.Result),
|
|
Limit: request.Limit,
|
|
Offset: request.Offset,
|
|
TotalResult: result.TotalResult,
|
|
}, nil
|
|
}
|
|
|
|
func (s *Server) IsOrgUnique(ctx context.Context, request *UniqueOrgRequest) (org *UniqueOrgResponse, err error) {
|
|
isUnique, err := s.org.IsOrgUnique(ctx, request.Name, request.Domain)
|
|
|
|
return &UniqueOrgResponse{IsUnique: isUnique}, err
|
|
}
|
|
|
|
func (s *Server) SetUpOrg(ctx context.Context, orgSetUp *OrgSetUpRequest) (_ *OrgSetUpResponse, err error) {
|
|
setUp, err := s.org.SetUpOrg(ctx, setUpRequestToModel(orgSetUp))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return setUpOrgResponseFromModel(setUp), err
|
|
}
|
|
|
|
func (s *Server) GetOrgIamPolicy(ctx context.Context, in *OrgIamPolicyID) (_ *OrgIamPolicy, err error) {
|
|
policy, err := s.org.GetOrgIamPolicyByID(ctx, in.OrgId)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return orgIamPolicyFromModel(policy), err
|
|
}
|
|
|
|
func (s *Server) CreateOrgIamPolicy(ctx context.Context, in *OrgIamPolicyRequest) (_ *OrgIamPolicy, err error) {
|
|
policy, err := s.org.CreateOrgIamPolicy(ctx, orgIamPolicyRequestToModel(in))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return orgIamPolicyFromModel(policy), err
|
|
}
|
|
|
|
func (s *Server) UpdateOrgIamPolicy(ctx context.Context, in *OrgIamPolicyRequest) (_ *OrgIamPolicy, err error) {
|
|
policy, err := s.org.ChangeOrgIamPolicy(ctx, orgIamPolicyRequestToModel(in))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return orgIamPolicyFromModel(policy), err
|
|
}
|
|
|
|
func (s *Server) DeleteOrgIamPolicy(ctx context.Context, in *OrgIamPolicyID) (_ *empty.Empty, err error) {
|
|
err = s.org.RemoveOrgIamPolicy(ctx, in.OrgId)
|
|
return &empty.Empty{}, err
|
|
}
|