fix: rename iam to instance (#3345)

* fix: rename iam command side to instance

* fix: rename iam command side to instance

* fix: rename iam command side to instance

* fix: rename iam command side to instance

* fix: rename orgiampolicy to domain policy

* fix: merge conflicts

* fix: protos

* fix: md files

* implement deprecated org iam policy again

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Fabi
2022-03-24 17:21:34 +01:00
committed by GitHub
parent 504fe5b761
commit 9d4f296c62
274 changed files with 12073 additions and 11853 deletions

View File

@@ -10,7 +10,7 @@ import (
"github.com/caos/zitadel/internal/eventstore"
"github.com/caos/zitadel/internal/eventstore/handler"
"github.com/caos/zitadel/internal/eventstore/repository"
"github.com/caos/zitadel/internal/repository/iam"
"github.com/caos/zitadel/internal/repository/instance"
"github.com/caos/zitadel/internal/repository/org"
)
@@ -25,11 +25,11 @@ func TestIDPProjection_reduces(t *testing.T) {
want wantReduce
}{
{
name: "iam.reduceIDPAdded",
name: "instance.reduceIDPAdded",
args: args{
event: getEvent(testEvent(
repository.EventType(iam.IDPConfigAddedEventType),
iam.AggregateType,
repository.EventType(instance.IDPConfigAddedEventType),
instance.AggregateType,
[]byte(`{
"idpConfigId": "idp-config-id",
"name": "custom-zitadel-instance",
@@ -37,11 +37,11 @@ func TestIDPProjection_reduces(t *testing.T) {
"stylingType": 0,
"autoRegister": true
}`),
), iam.IDPConfigAddedEventMapper),
), instance.IDPConfigAddedEventMapper),
},
reduce: (&IDPProjection{}).reduceIDPAdded,
want: wantReduce{
aggregateType: eventstore.AggregateType("iam"),
aggregateType: eventstore.AggregateType("instance"),
sequence: 15,
previousSequence: 10,
projection: IDPTable,
@@ -68,22 +68,22 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "iam.reduceIDPChanged",
name: "instance.reduceIDPChanged",
args: args{
event: getEvent(testEvent(
repository.EventType(iam.IDPConfigChangedEventType),
iam.AggregateType,
repository.EventType(instance.IDPConfigChangedEventType),
instance.AggregateType,
[]byte(`{
"idpConfigId": "idp-config-id",
"name": "custom-zitadel-instance",
"stylingType": 1,
"autoRegister": true
}`),
), iam.IDPConfigChangedEventMapper),
), instance.IDPConfigChangedEventMapper),
},
reduce: (&IDPProjection{}).reduceIDPChanged,
want: wantReduce{
aggregateType: eventstore.AggregateType("iam"),
aggregateType: eventstore.AggregateType("instance"),
sequence: 15,
previousSequence: 10,
projection: IDPTable,
@@ -105,19 +105,19 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "iam.reduceIDPDeactivated",
name: "instance.reduceIDPDeactivated",
args: args{
event: getEvent(testEvent(
repository.EventType(iam.IDPConfigDeactivatedEventType),
iam.AggregateType,
repository.EventType(instance.IDPConfigDeactivatedEventType),
instance.AggregateType,
[]byte(`{
"idpConfigId": "idp-config-id"
}`),
), iam.IDPConfigDeactivatedEventMapper),
), instance.IDPConfigDeactivatedEventMapper),
},
reduce: (&IDPProjection{}).reduceIDPDeactivated,
want: wantReduce{
aggregateType: eventstore.AggregateType("iam"),
aggregateType: eventstore.AggregateType("instance"),
sequence: 15,
previousSequence: 10,
projection: IDPTable,
@@ -137,19 +137,19 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "iam.reduceIDPReactivated",
name: "instance.reduceIDPReactivated",
args: args{
event: getEvent(testEvent(
repository.EventType(iam.IDPConfigReactivatedEventType),
iam.AggregateType,
repository.EventType(instance.IDPConfigReactivatedEventType),
instance.AggregateType,
[]byte(`{
"idpConfigId": "idp-config-id"
}`),
), iam.IDPConfigReactivatedEventMapper),
), instance.IDPConfigReactivatedEventMapper),
},
reduce: (&IDPProjection{}).reduceIDPReactivated,
want: wantReduce{
aggregateType: eventstore.AggregateType("iam"),
aggregateType: eventstore.AggregateType("instance"),
sequence: 15,
previousSequence: 10,
projection: IDPTable,
@@ -169,19 +169,19 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "iam.reduceIDPRemoved",
name: "instance.reduceIDPRemoved",
args: args{
event: getEvent(testEvent(
repository.EventType(iam.IDPConfigRemovedEventType),
iam.AggregateType,
repository.EventType(instance.IDPConfigRemovedEventType),
instance.AggregateType,
[]byte(`{
"idpConfigId": "idp-config-id"
}`),
), iam.IDPConfigRemovedEventMapper),
), instance.IDPConfigRemovedEventMapper),
},
reduce: (&IDPProjection{}).reduceIDPRemoved,
want: wantReduce{
aggregateType: eventstore.AggregateType("iam"),
aggregateType: eventstore.AggregateType("instance"),
sequence: 15,
previousSequence: 10,
projection: IDPTable,
@@ -198,11 +198,11 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "iam.reduceOIDCConfigAdded",
name: "instance.reduceOIDCConfigAdded",
args: args{
event: getEvent(testEvent(
repository.EventType(iam.IDPOIDCConfigAddedEventType),
iam.AggregateType,
repository.EventType(instance.IDPOIDCConfigAddedEventType),
instance.AggregateType,
[]byte(`{
"idpConfigId": "idp-config-id",
"clientId": "client-id",
@@ -218,11 +218,11 @@ func TestIDPProjection_reduces(t *testing.T) {
"idpDisplayNameMapping": 0,
"usernameMapping": 1
}`),
), iam.IDPOIDCConfigAddedEventMapper),
), instance.IDPOIDCConfigAddedEventMapper),
},
reduce: (&IDPProjection{}).reduceOIDCConfigAdded,
want: wantReduce{
aggregateType: eventstore.AggregateType("iam"),
aggregateType: eventstore.AggregateType("instance"),
sequence: 15,
previousSequence: 10,
projection: IDPTable,
@@ -256,11 +256,11 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "iam.reduceOIDCConfigChanged",
name: "instance.reduceOIDCConfigChanged",
args: args{
event: getEvent(testEvent(
repository.EventType(iam.IDPOIDCConfigChangedEventType),
iam.AggregateType,
repository.EventType(instance.IDPOIDCConfigChangedEventType),
instance.AggregateType,
[]byte(`{
"idpConfigId": "idp-config-id",
"clientId": "client-id",
@@ -276,11 +276,11 @@ func TestIDPProjection_reduces(t *testing.T) {
"idpDisplayNameMapping": 0,
"usernameMapping": 1
}`),
), iam.IDPOIDCConfigChangedEventMapper),
), instance.IDPOIDCConfigChangedEventMapper),
},
reduce: (&IDPProjection{}).reduceOIDCConfigChanged,
want: wantReduce{
aggregateType: eventstore.AggregateType("iam"),
aggregateType: eventstore.AggregateType("instance"),
sequence: 15,
previousSequence: 10,
projection: IDPTable,
@@ -313,17 +313,17 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "iam.reduceOIDCConfigChanged: no op",
name: "instance.reduceOIDCConfigChanged: no op",
args: args{
event: getEvent(testEvent(
repository.EventType(iam.IDPOIDCConfigChangedEventType),
iam.AggregateType,
repository.EventType(instance.IDPOIDCConfigChangedEventType),
instance.AggregateType,
[]byte("{}"),
), iam.IDPOIDCConfigChangedEventMapper),
), instance.IDPOIDCConfigChangedEventMapper),
},
reduce: (&IDPProjection{}).reduceOIDCConfigChanged,
want: wantReduce{
aggregateType: eventstore.AggregateType("iam"),
aggregateType: eventstore.AggregateType("instance"),
sequence: 15,
previousSequence: 10,
projection: IDPTable,
@@ -333,11 +333,11 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "iam.reduceJWTConfigAdded",
name: "instance.reduceJWTConfigAdded",
args: args{
event: getEvent(testEvent(
repository.EventType(iam.IDPJWTConfigAddedEventType),
iam.AggregateType,
repository.EventType(instance.IDPJWTConfigAddedEventType),
instance.AggregateType,
[]byte(`{
"idpConfigId": "idp-config-id",
"jwtEndpoint": "https://api.zitadel.ch/jwt",
@@ -345,11 +345,11 @@ func TestIDPProjection_reduces(t *testing.T) {
"keysEndpoint": "https://api.zitadel.ch/keys",
"headerName": "hodor"
}`),
), iam.IDPJWTConfigAddedEventMapper),
), instance.IDPJWTConfigAddedEventMapper),
},
reduce: (&IDPProjection{}).reduceJWTConfigAdded,
want: wantReduce{
aggregateType: eventstore.AggregateType("iam"),
aggregateType: eventstore.AggregateType("instance"),
sequence: 15,
previousSequence: 10,
projection: IDPTable,
@@ -379,11 +379,11 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "iam.reduceJWTConfigChanged",
name: "instance.reduceJWTConfigChanged",
args: args{
event: getEvent(testEvent(
repository.EventType(iam.IDPJWTConfigChangedEventType),
iam.AggregateType,
repository.EventType(instance.IDPJWTConfigChangedEventType),
instance.AggregateType,
[]byte(`{
"idpConfigId": "idp-config-id",
"jwtEndpoint": "https://api.zitadel.ch/jwt",
@@ -391,11 +391,11 @@ func TestIDPProjection_reduces(t *testing.T) {
"keysEndpoint": "https://api.zitadel.ch/keys",
"headerName": "hodor"
}`),
), iam.IDPJWTConfigChangedEventMapper),
), instance.IDPJWTConfigChangedEventMapper),
},
reduce: (&IDPProjection{}).reduceJWTConfigChanged,
want: wantReduce{
aggregateType: eventstore.AggregateType("iam"),
aggregateType: eventstore.AggregateType("instance"),
sequence: 15,
previousSequence: 10,
projection: IDPTable,
@@ -424,17 +424,17 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "iam.reduceJWTConfigChanged: no op",
name: "instance.reduceJWTConfigChanged: no op",
args: args{
event: getEvent(testEvent(
repository.EventType(iam.IDPJWTConfigChangedEventType),
iam.AggregateType,
repository.EventType(instance.IDPJWTConfigChangedEventType),
instance.AggregateType,
[]byte(`{}`),
), iam.IDPJWTConfigChangedEventMapper),
), instance.IDPJWTConfigChangedEventMapper),
},
reduce: (&IDPProjection{}).reduceJWTConfigChanged,
want: wantReduce{
aggregateType: eventstore.AggregateType("iam"),
aggregateType: eventstore.AggregateType("instance"),
sequence: 15,
previousSequence: 10,
projection: IDPTable,