mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-30 02:52:16 +00:00
feat: multiple domains (#188)
* 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 <[email protected]> * fix: fix unique domains * fix: rename env variable Co-authored-by: adlerhurst <[email protected]> Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
co-authored by
Livio Amstutz
adlerhurst
parent
64b14b4e19
commit
7a6ca24625
+19
-47
@@ -2,10 +2,7 @@ package grpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/zitadel/internal/model"
|
||||
|
||||
org_model "github.com/caos/zitadel/internal/org/model"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
)
|
||||
|
||||
func (s *Server) GetOrgByID(ctx context.Context, orgID *OrgID) (_ *Org, err error) {
|
||||
@@ -43,56 +40,31 @@ func (s *Server) SetUpOrg(ctx context.Context, orgSetUp *OrgSetUpRequest) (_ *Or
|
||||
return setUpOrgResponseFromModel(setUp), err
|
||||
}
|
||||
|
||||
func orgSearchRequestToModel(req *OrgSearchRequest) *org_model.OrgSearchRequest {
|
||||
return &org_model.OrgSearchRequest{
|
||||
Limit: req.Limit,
|
||||
Asc: req.Asc,
|
||||
Offset: req.Offset,
|
||||
Queries: orgQueriesToModel(req.Queries),
|
||||
SortingColumn: orgQueryKeyToModel(req.SortingColumn),
|
||||
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 orgQueriesToModel(queries []*OrgSearchQuery) []*org_model.OrgSearchQuery {
|
||||
modelQueries := make([]*org_model.OrgSearchQuery, len(queries))
|
||||
|
||||
for i, query := range queries {
|
||||
modelQueries[i] = orgQueryToModel(query)
|
||||
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 modelQueries
|
||||
return orgIamPolicyFromModel(policy), err
|
||||
}
|
||||
|
||||
func orgQueryToModel(query *OrgSearchQuery) *org_model.OrgSearchQuery {
|
||||
return &org_model.OrgSearchQuery{
|
||||
Key: orgQueryKeyToModel(query.Key),
|
||||
Value: query.Value,
|
||||
Method: orgQueryMethodToModel(query.Method),
|
||||
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 orgQueryKeyToModel(key OrgSearchKey) org_model.OrgSearchKey {
|
||||
switch key {
|
||||
case OrgSearchKey_ORGSEARCHKEY_DOMAIN:
|
||||
return org_model.ORGSEARCHKEY_ORG_DOMAIN
|
||||
case OrgSearchKey_ORGSEARCHKEY_ORG_NAME:
|
||||
return org_model.ORGSEARCHKEY_ORG_NAME
|
||||
case OrgSearchKey_ORGSEARCHKEY_STATE:
|
||||
return org_model.ORGSEARCHKEY_STATE
|
||||
default:
|
||||
return org_model.ORGSEARCHKEY_UNSPECIFIED
|
||||
}
|
||||
}
|
||||
|
||||
func orgQueryMethodToModel(method OrgSearchMethod) model.SearchMethod {
|
||||
switch method {
|
||||
case OrgSearchMethod_ORGSEARCHMETHOD_CONTAINS:
|
||||
return model.SEARCHMETHOD_CONTAINS
|
||||
case OrgSearchMethod_ORGSEARCHMETHOD_EQUALS:
|
||||
return model.SEARCHMETHOD_EQUALS
|
||||
case OrgSearchMethod_ORGSEARCHMETHOD_STARTS_WITH:
|
||||
return model.SEARCHMETHOD_STARTS_WITH
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
func (s *Server) DeleteOrgIamPolicy(ctx context.Context, in *OrgIamPolicyID) (_ *empty.Empty, err error) {
|
||||
err = s.org.RemoveOrgIamPolicy(ctx, in.OrgId)
|
||||
return &empty.Empty{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user