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

@@ -8,22 +8,22 @@ import (
iam_model "github.com/caos/zitadel/internal/iam/model"
)
type OrgIAMPolicy struct {
type DomainPolicy struct {
es_models.ObjectRoot
State int32 `json:"-"`
UserLoginMustBeDomain bool `json:"userLoginMustBeDomain"`
}
func OrgIAMPolicyToModel(policy *OrgIAMPolicy) *iam_model.OrgIAMPolicy {
return &iam_model.OrgIAMPolicy{
func DomainPolicyToModel(policy *DomainPolicy) *iam_model.DomainPolicy {
return &iam_model.DomainPolicy{
ObjectRoot: policy.ObjectRoot,
State: iam_model.PolicyState(policy.State),
UserLoginMustBeDomain: policy.UserLoginMustBeDomain,
}
}
func (p *OrgIAMPolicy) Changes(changed *OrgIAMPolicy) map[string]interface{} {
func (p *DomainPolicy) Changes(changed *DomainPolicy) map[string]interface{} {
changes := make(map[string]interface{}, 1)
if p.UserLoginMustBeDomain != changed.UserLoginMustBeDomain {
@@ -32,7 +32,7 @@ func (p *OrgIAMPolicy) Changes(changed *OrgIAMPolicy) map[string]interface{} {
return changes
}
func (p *OrgIAMPolicy) SetData(event *es_models.Event) error {
func (p *DomainPolicy) SetData(event *es_models.Event) error {
err := json.Unmarshal(event.Data, p)
if err != nil {
return errors.ThrowInternal(err, "EVENT-7JS9d", "unable to unmarshal data")

View File

@@ -6,8 +6,8 @@ import (
func TestOrgIAMPolicyChanges(t *testing.T) {
type args struct {
existing *OrgIAMPolicy
new *OrgIAMPolicy
existing *DomainPolicy
new *DomainPolicy
}
type res struct {
changesLen int
@@ -20,8 +20,8 @@ func TestOrgIAMPolicyChanges(t *testing.T) {
{
name: "org iam policy all attributes change",
args: args{
existing: &OrgIAMPolicy{UserLoginMustBeDomain: true},
new: &OrgIAMPolicy{UserLoginMustBeDomain: false},
existing: &DomainPolicy{UserLoginMustBeDomain: true},
new: &DomainPolicy{UserLoginMustBeDomain: false},
},
res: res{
changesLen: 1,
@@ -30,8 +30,8 @@ func TestOrgIAMPolicyChanges(t *testing.T) {
{
name: "no changes",
args: args{
existing: &OrgIAMPolicy{UserLoginMustBeDomain: true},
new: &OrgIAMPolicy{UserLoginMustBeDomain: true},
existing: &DomainPolicy{UserLoginMustBeDomain: true},
new: &DomainPolicy{UserLoginMustBeDomain: true},
},
res: res{
changesLen: 0,