mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-12 11:53:39 +00:00
fix: add migration (#361)
* fix: add migration * fix: add migration * fix: delete primary domain * Update en.yaml Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
parent
eaef079852
commit
fb2091edc9
@ -49,13 +49,13 @@ func (o *Org) IsValid() bool {
|
||||
return o.Name != ""
|
||||
}
|
||||
|
||||
func (o *Org) ContainsDomain(domain *OrgDomain) bool {
|
||||
for _, d := range o.Domains {
|
||||
func (o *Org) GetDomain(domain *OrgDomain) (int, *OrgDomain) {
|
||||
for i, d := range o.Domains {
|
||||
if d.Domain == domain.Domain {
|
||||
return true
|
||||
return i, d
|
||||
}
|
||||
}
|
||||
return false
|
||||
return -1, nil
|
||||
}
|
||||
|
||||
func (o *Org) GetPrimaryDomain() *OrgDomain {
|
||||
|
@ -179,9 +179,13 @@ func (es *OrgEventstore) RemoveOrgDomain(ctx context.Context, domain *org_model.
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !existing.ContainsDomain(domain) {
|
||||
_, d := existing.GetDomain(domain)
|
||||
if d == nil {
|
||||
return errors.ThrowPreconditionFailed(nil, "EVENT-Sjdi3", "Errors.Org.DomainNotOnOrg")
|
||||
}
|
||||
if d.Primary {
|
||||
return errors.ThrowPreconditionFailed(nil, "EVENT-Sjdi3", "Errors.Org.PrimaryDomainNotDeletable")
|
||||
}
|
||||
repoOrg := model.OrgFromModel(existing)
|
||||
repoDomain := model.OrgDomainFromModel(domain)
|
||||
orgAggregates, err := OrgDomainRemovedAggregate(ctx, es.Eventstore.AggregateCreator(), repoOrg, repoDomain)
|
||||
|
@ -54,6 +54,7 @@ Errors:
|
||||
InvalidDomain: Domäne ist ungültig
|
||||
DomainMissing: Domäne fehlt
|
||||
DomainNotOnOrg: Domäne fehlt auf Organisation
|
||||
PrimaryDomainNotDeletable: Primäre Domäne kann nicht gelöscht werden
|
||||
DomainNotFound: Domäne konnte nicht gefunden werden
|
||||
MemberIDMissing: Member ID fehlt
|
||||
MemberNotFound: Organisations Member konnte nicht gefunden werden
|
||||
|
@ -54,6 +54,7 @@ Errors:
|
||||
InvalidDomain: Invalid domain
|
||||
DomainMissing: Domain missing
|
||||
DomainNotOnOrg: Domain doesn't exist on organisation
|
||||
PrimaryDomainNotDeletable: Primary domain must not be deleted
|
||||
DomainNotFound: Domain not found
|
||||
MemberIDMissing: Member ID missing
|
||||
MemberNotFound: Organisations member not found
|
||||
@ -113,4 +114,4 @@ Errors:
|
||||
Token:
|
||||
NotFound: Token not found
|
||||
UserSession:
|
||||
NotFound: UserSession not found
|
||||
NotFound: UserSession not found
|
||||
|
2
migrations/cockroach/V1.27__adminapi_grants.sql
Normal file
2
migrations/cockroach/V1.27__adminapi_grants.sql
Normal file
@ -0,0 +1,2 @@
|
||||
GRANT DROP ON DATABASE admin_api TO admin_api;
|
||||
GRANT DROP ON TABLE admin_api.* TO admin_api;
|
Loading…
x
Reference in New Issue
Block a user