mirror of
https://github.com/zitadel/zitadel.git
synced 2025-04-23 08:41:31 +00:00
fix: set project changes correctly in application view model (#1469)
This commit is contained in:
parent
08b066b3a2
commit
d7255130a4
@ -179,10 +179,7 @@ func (a *ApplicationView) AppendEvent(event *models.Event) (err error) {
|
|||||||
case es_model.APIConfigChanged:
|
case es_model.APIConfigChanged:
|
||||||
return a.SetData(event)
|
return a.SetData(event)
|
||||||
case es_model.ProjectChanged:
|
case es_model.ProjectChanged:
|
||||||
project := &es_model.Project{}
|
return a.setProjectChanges(event)
|
||||||
project.SetData(event)
|
|
||||||
a.ProjectRoleAssertion = project.ProjectRoleAssertion
|
|
||||||
a.ProjectRoleCheck = project.ProjectRoleAssertion
|
|
||||||
case es_model.ApplicationDeactivated:
|
case es_model.ApplicationDeactivated:
|
||||||
a.State = int32(model.AppStateInactive)
|
a.State = int32(model.AppStateInactive)
|
||||||
case es_model.ApplicationReactivated:
|
case es_model.ApplicationReactivated:
|
||||||
@ -225,3 +222,21 @@ func (a *ApplicationView) setCompliance() {
|
|||||||
a.NoneCompliant = compliance.NoneCompliant
|
a.NoneCompliant = compliance.NoneCompliant
|
||||||
a.ComplianceProblems = compliance.Problems
|
a.ComplianceProblems = compliance.Problems
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *ApplicationView) setProjectChanges(event *models.Event) error {
|
||||||
|
changes := struct {
|
||||||
|
ProjectRoleAssertion *bool `json:"projectRoleAssertion,omitempty"`
|
||||||
|
ProjectRoleCheck *bool `json:"projectRoleCheck,omitempty"`
|
||||||
|
}{}
|
||||||
|
if err := json.Unmarshal(event.Data, &changes); err != nil {
|
||||||
|
logging.Log("EVEN-DFbfg").WithError(err).Error("could not unmarshal event data")
|
||||||
|
return caos_errs.ThrowInternal(err, "MODEL-Bw221", "Could not unmarshal data")
|
||||||
|
}
|
||||||
|
if changes.ProjectRoleAssertion != nil {
|
||||||
|
a.ProjectRoleAssertion = *changes.ProjectRoleAssertion
|
||||||
|
}
|
||||||
|
if changes.ProjectRoleCheck != nil {
|
||||||
|
a.ProjectRoleCheck = *changes.ProjectRoleCheck
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user