mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 15:49:35 +00:00
fixup! fixup! fix(org): adding unique constrants to not allow an org to be added twice with same id
This commit is contained in:
@@ -52,7 +52,7 @@ func TestServer_CreateOrganization(t *testing.T) {
|
||||
ctx context.Context
|
||||
req *v2beta_org.CreateOrganizationRequest
|
||||
id string
|
||||
testfunc func(ctx context.Context, t *testing.T)
|
||||
testFunc func(ctx context.Context, t *testing.T)
|
||||
want *v2beta_org.CreateOrganizationResponse
|
||||
wantErr bool
|
||||
}
|
||||
@@ -85,8 +85,8 @@ func TestServer_CreateOrganization(t *testing.T) {
|
||||
Name: orgName,
|
||||
Admins: nil,
|
||||
},
|
||||
testfunc: func(ctx context.Context, t *testing.T) {
|
||||
// create org initally
|
||||
testFunc: func(ctx context.Context, t *testing.T) {
|
||||
// create org initially
|
||||
_, err := Client.CreateOrganization(ctx, &v2beta_org.CreateOrganizationRequest{
|
||||
Name: orgName,
|
||||
})
|
||||
@@ -238,14 +238,15 @@ func TestServer_CreateOrganization(t *testing.T) {
|
||||
name: "adding org with same ID twice",
|
||||
ctx: CTX,
|
||||
req: &v2beta_org.CreateOrganizationRequest{
|
||||
Name: orgID,
|
||||
Id: &orgID,
|
||||
Name: gofakeit.Name(),
|
||||
Admins: nil,
|
||||
},
|
||||
testfunc: func(ctx context.Context, t *testing.T) {
|
||||
// create org initally
|
||||
testFunc: func(ctx context.Context, t *testing.T) {
|
||||
// create org initially
|
||||
_, err := Client.CreateOrganization(ctx, &v2beta_org.CreateOrganizationRequest{
|
||||
Name: gofakeit.AppName(),
|
||||
Id: &orgID,
|
||||
Name: gofakeit.Name(),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
},
|
||||
@@ -255,8 +256,8 @@ func TestServer_CreateOrganization(t *testing.T) {
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if tt.testfunc != nil {
|
||||
tt.testfunc(tt.ctx, t)
|
||||
if tt.testFunc != nil {
|
||||
tt.testFunc(tt.ctx, t)
|
||||
}
|
||||
|
||||
got, err := Client.CreateOrganization(tt.ctx, tt.req)
|
||||
|
@@ -52,7 +52,6 @@ func NewRemoveOrgNameUniqueConstraint(orgName string) *eventstore.UniqueConstrai
|
||||
type OrgAddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
@@ -61,7 +60,7 @@ func (e *OrgAddedEvent) Payload() interface{} {
|
||||
}
|
||||
|
||||
func (e *OrgAddedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||
return []*eventstore.UniqueConstraint{NewAddOrgIDUniqueConstraint(e.ID), NewAddOrgNameUniqueConstraint(e.Name)}
|
||||
return []*eventstore.UniqueConstraint{NewAddOrgIDUniqueConstraint(e.Aggregate().ID), NewAddOrgNameUniqueConstraint(e.Name)}
|
||||
}
|
||||
|
||||
func (e *OrgAddedEvent) Fields() []*eventstore.FieldOperation {
|
||||
@@ -108,7 +107,6 @@ func NewOrgAddedEvent(ctx context.Context, aggregate *eventstore.Aggregate, name
|
||||
aggregate,
|
||||
OrgAddedEventType,
|
||||
),
|
||||
ID: aggregate.ID,
|
||||
Name: name,
|
||||
}
|
||||
}
|
||||
@@ -291,7 +289,6 @@ func OrgReactivatedEventMapper(event eventstore.Event) (eventstore.Event, error)
|
||||
|
||||
type OrgRemovedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
id string
|
||||
name string
|
||||
usernames []string
|
||||
loginMustBeDomain bool
|
||||
@@ -306,7 +303,7 @@ func (e *OrgRemovedEvent) Payload() interface{} {
|
||||
|
||||
func (e *OrgRemovedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||
constraints := []*eventstore.UniqueConstraint{
|
||||
NewRemoveOrgIDUniqueConstraint(e.id),
|
||||
NewRemoveOrgIDUniqueConstraint(e.Aggregate().ID),
|
||||
NewRemoveOrgNameUniqueConstraint(e.name),
|
||||
}
|
||||
for _, name := range e.usernames {
|
||||
@@ -338,7 +335,6 @@ func NewOrgRemovedEvent(ctx context.Context, aggregate *eventstore.Aggregate, na
|
||||
aggregate,
|
||||
OrgRemovedEventType,
|
||||
),
|
||||
id: aggregate.ID,
|
||||
name: name,
|
||||
usernames: usernames,
|
||||
domains: domains,
|
||||
|
@@ -196,7 +196,7 @@ Errors:
|
||||
AlreadyExists: Екземплярът вече съществува
|
||||
NotChanged: Екземплярът не е променен
|
||||
Org:
|
||||
AlreadyExists: Името на организацията вече е заето
|
||||
AlreadyExists: Името или идентификационният номер на организацията вече е зает.
|
||||
Invalid: Организацията е невалидна
|
||||
AlreadyDeactivated: Организацията вече е деактивирана
|
||||
AlreadyActive: Организацията вече е активна
|
||||
|
@@ -194,7 +194,7 @@ Errors:
|
||||
AlreadyExists: Instance již existuje
|
||||
NotChanged: Instance nezměněna
|
||||
Org:
|
||||
AlreadyExists: Název organizace je již obsazen
|
||||
AlreadyExists: Името или идентификационният номер на организацията вече е зает
|
||||
Invalid: Organizace je neplatná
|
||||
AlreadyDeactivated: Organizace je již deaktivována
|
||||
AlreadyActive: Organizace je již aktivní
|
||||
|
@@ -194,7 +194,7 @@ Errors:
|
||||
AlreadyExists: Instanz exisitiert bereits
|
||||
NotChanged: Instanz wurde nicht verändert
|
||||
Org:
|
||||
AlreadyExists: Organisationsname existiert bereits
|
||||
AlreadyExists: Der Name oder die ID der Organisation ist bereits vorhanden
|
||||
Invalid: Organisation ist ungültig
|
||||
AlreadyDeactivated: Organisation ist bereits deaktiviert
|
||||
AlreadyActive: Organisation ist bereits aktiv
|
||||
|
@@ -194,7 +194,7 @@ Errors:
|
||||
AlreadyExists: La instancia ya existe
|
||||
NotChanged: La instancia no ha cambiado
|
||||
Org:
|
||||
AlreadyExists: El nombre de la organización ya está cogido
|
||||
AlreadyExists: El nombre o id de la organización ya está tomado
|
||||
Invalid: El nombre de la organización no es válido
|
||||
AlreadyDeactivated: La organización ya está desactivada
|
||||
AlreadyActive: La organización ya está activada
|
||||
|
@@ -194,7 +194,7 @@ Errors:
|
||||
AlreadyExists: L'instance existe déjà
|
||||
NotChanged: L'instance n'a pas changé
|
||||
Org:
|
||||
AlreadyExists: Le nom de l'organisation est déjà pris
|
||||
AlreadyExists: Le nom de l'organisation ou l'identifiant est déjà pris
|
||||
Invalid: L'organisation n'est pas valide
|
||||
AlreadyDeactivated: L'organisation est déjà désactivée
|
||||
AlreadyActive: L'organisation est déjà active
|
||||
|
@@ -194,7 +194,7 @@ Errors:
|
||||
AlreadyExists: Az instance már létezik
|
||||
NotChanged: Az instance nem változott
|
||||
Org:
|
||||
AlreadyExists: A szervezet neve már foglalt
|
||||
AlreadyExists: A szervezet neve vagy azonosítója már foglalt
|
||||
Invalid: A szervezet érvénytelen
|
||||
AlreadyDeactivated: A szervezet már deaktiválva van
|
||||
AlreadyActive: A szervezet már aktív
|
||||
|
@@ -194,7 +194,7 @@ Errors:
|
||||
AlreadyExists: Contoh sudah ada
|
||||
NotChanged: Contoh tidak berubah
|
||||
Org:
|
||||
AlreadyExists: Nama organisasi sudah dipakai
|
||||
AlreadyExists: Nama atau ID organisasi sudah digunakan
|
||||
Invalid: Organisasi tidak valid
|
||||
AlreadyDeactivated: Organisasi sudah dinonaktifkan
|
||||
AlreadyActive: Organisasi sudah aktif
|
||||
|
@@ -194,7 +194,7 @@ Errors:
|
||||
AlreadyExists: L'istanza esiste già
|
||||
NotChanged: Istanza non modificata
|
||||
Org:
|
||||
AlreadyExists: Nome dell'organizzazione già preso
|
||||
AlreadyExists: Nome o ID dell'organizzazione già utilizzato
|
||||
Invalid: L'organizzazione non è valida
|
||||
AlreadyDeactivated: L'organizzazione è già disattivata
|
||||
AlreadyActive: L'organizzazione è già attiva
|
||||
|
@@ -195,7 +195,7 @@ Errors:
|
||||
AlreadyExists: すでに存在するインスタンス
|
||||
NotChanged: インスタンスは変更されていません
|
||||
Org:
|
||||
AlreadyExists: 組織の名前はすでに使用されています
|
||||
AlreadyExists: 組織名またはIDはすでに使用されています
|
||||
Invalid: 無効な組織です
|
||||
AlreadyDeactivated: 組織はすでに非アクティブです
|
||||
AlreadyActive: 組織はすでにアクティブです
|
||||
|
@@ -195,7 +195,7 @@ Errors:
|
||||
AlreadyExists: 인스턴스가 이미 존재합니다
|
||||
NotChanged: 인스턴스가 변경되지 않았습니다
|
||||
Org:
|
||||
AlreadyExists: 조직 이름이 이미 사용 중입니다
|
||||
AlreadyExists: 조직 이름 또는 ID가 이미 사용 중입니다
|
||||
Invalid: 조직이 유효하지 않습니다
|
||||
AlreadyDeactivated: 조직이 이미 비활성화되었습니다
|
||||
AlreadyActive: 조직이 이미 활성화되었습니다
|
||||
|
@@ -193,7 +193,7 @@ Errors:
|
||||
AlreadyExists: Инстанцата веќе постои
|
||||
NotChanged: Инстанцата не е променета
|
||||
Org:
|
||||
AlreadyExists: Името на организацијата е веќе зафатено
|
||||
AlreadyExists: Името или ID-то на организацијата е веќе зафатено
|
||||
Invalid: Организацијата е невалидна
|
||||
AlreadyDeactivated: Организацијата е веќе деактивирана
|
||||
AlreadyActive: Организацијата е веќе активна
|
||||
|
@@ -194,7 +194,7 @@ Errors:
|
||||
AlreadyExists: Instantie bestaat al
|
||||
NotChanged: Instantie is niet veranderd
|
||||
Org:
|
||||
AlreadyExists: Organisatienaam is al in gebruik
|
||||
AlreadyExists: Organisatienaam of -id is al in gebruik
|
||||
Invalid: Organisatie is ongeldig
|
||||
AlreadyDeactivated: Organisatie is al gedeactiveerd
|
||||
AlreadyActive: Organisatie is al actief
|
||||
|
@@ -194,7 +194,7 @@ Errors:
|
||||
AlreadyExists: Instancja już istnieje
|
||||
NotChanged: Instancja nie zmieniona
|
||||
Org:
|
||||
AlreadyExists: Nazwa organizacji jest już zajęta
|
||||
AlreadyExists: Nazwa lub identyfikator organizacji jest już zajęty
|
||||
Invalid: Organizacja jest nieprawidłowa
|
||||
AlreadyDeactivated: Organizacja jest już deaktywowana
|
||||
AlreadyActive: Organizacja jest już aktywna
|
||||
|
@@ -193,7 +193,7 @@ Errors:
|
||||
AlreadyExists: Instância já existe
|
||||
NotChanged: Instância não alterada
|
||||
Org:
|
||||
AlreadyExists: Nome da organização já está em uso
|
||||
AlreadyExists: O nome ou ID da organização já está em uso
|
||||
Invalid: Organização é inválida
|
||||
AlreadyDeactivated: Organização já está desativada
|
||||
AlreadyActive: Organização já está ativa
|
||||
|
@@ -195,7 +195,7 @@ Errors:
|
||||
AlreadyExists: Instanța există deja
|
||||
NotChanged: Instanța nu a fost schimbată
|
||||
Org:
|
||||
AlreadyExists: Numele organizației este deja luat
|
||||
AlreadyExists: Numele sau ID-ul organizației este deja utilizat
|
||||
Invalid: Organizația este invalidă
|
||||
AlreadyDeactivated: Organizația este deja dezactivată
|
||||
AlreadyActive: Organizația este deja activă
|
||||
|
@@ -194,7 +194,7 @@ Errors:
|
||||
AlreadyExists: Экземпляр уже существует
|
||||
NotChanged: Экземпляр не изменён
|
||||
Org:
|
||||
AlreadyExists: Название организации уже занято
|
||||
AlreadyExists: Название организации или идентификатор уже занят
|
||||
Invalid: Организация недействительна
|
||||
AlreadyDeactivated: Организация уже деактивирована
|
||||
AlreadyActive: Организация уже активна
|
||||
|
@@ -194,7 +194,7 @@ Errors:
|
||||
AlreadyExists: Instans finns redan
|
||||
NotChanged: Instans ändrades inte
|
||||
Org:
|
||||
AlreadyExists: Organisationens namn är redan taget
|
||||
AlreadyExists: Organisationens namn eller ID är redan upptaget
|
||||
Invalid: Organisationen är ogiltigt
|
||||
AlreadyDeactivated: Organisation är redan avaktiverad
|
||||
AlreadyActive: Organisationen är redan aktiv
|
||||
|
@@ -194,7 +194,7 @@ Errors:
|
||||
AlreadyExists: 实例已经存在
|
||||
NotChanged: 实例没有改变
|
||||
Org:
|
||||
AlreadyExists: 组织名称已被占用
|
||||
AlreadyExists: 该组织名称或 ID 已被占用
|
||||
Invalid: 组织无效
|
||||
AlreadyDeactivated: 组织已停用
|
||||
AlreadyActive: 组织已处于启用状态
|
||||
|
Reference in New Issue
Block a user