mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:37:32 +00:00
feat(idp): provide option to auto link user (#7734)
* init auto linking * prompt handling * working * translations * console * fixes * unify * custom texts * fix tests * linting * fix check of existing user * fix bg translation * set unspecified as default in the form
This commit is contained in:
@@ -1,22 +1,25 @@
|
||||
package idp
|
||||
|
||||
import (
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
"github.com/zitadel/zitadel/internal/zerrors"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
IsCreationAllowed bool `json:"isCreationAllowed,omitempty"`
|
||||
IsLinkingAllowed bool `json:"isLinkingAllowed,omitempty"`
|
||||
IsAutoCreation bool `json:"isAutoCreation,omitempty"`
|
||||
IsAutoUpdate bool `json:"isAutoUpdate,omitempty"`
|
||||
IsCreationAllowed bool `json:"isCreationAllowed,omitempty"`
|
||||
IsLinkingAllowed bool `json:"isLinkingAllowed,omitempty"`
|
||||
IsAutoCreation bool `json:"isAutoCreation,omitempty"`
|
||||
IsAutoUpdate bool `json:"isAutoUpdate,omitempty"`
|
||||
AutoLinkingOption domain.AutoLinkingOption `json:"autoLinkingOption,omitempty"`
|
||||
}
|
||||
|
||||
type OptionChanges struct {
|
||||
IsCreationAllowed *bool `json:"isCreationAllowed,omitempty"`
|
||||
IsLinkingAllowed *bool `json:"isLinkingAllowed,omitempty"`
|
||||
IsAutoCreation *bool `json:"isAutoCreation,omitempty"`
|
||||
IsAutoUpdate *bool `json:"isAutoUpdate,omitempty"`
|
||||
IsCreationAllowed *bool `json:"isCreationAllowed,omitempty"`
|
||||
IsLinkingAllowed *bool `json:"isLinkingAllowed,omitempty"`
|
||||
IsAutoCreation *bool `json:"isAutoCreation,omitempty"`
|
||||
IsAutoUpdate *bool `json:"isAutoUpdate,omitempty"`
|
||||
AutoLinkingOption *domain.AutoLinkingOption `json:"autoLinkingOption,omitempty"`
|
||||
}
|
||||
|
||||
func (o *Options) Changes(options Options) OptionChanges {
|
||||
@@ -33,6 +36,9 @@ func (o *Options) Changes(options Options) OptionChanges {
|
||||
if o.IsAutoUpdate != options.IsAutoUpdate {
|
||||
opts.IsAutoUpdate = &options.IsAutoUpdate
|
||||
}
|
||||
if o.AutoLinkingOption != options.AutoLinkingOption {
|
||||
opts.AutoLinkingOption = &options.AutoLinkingOption
|
||||
}
|
||||
return opts
|
||||
}
|
||||
|
||||
@@ -49,10 +55,13 @@ func (o *Options) ReduceChanges(changes OptionChanges) {
|
||||
if changes.IsAutoUpdate != nil {
|
||||
o.IsAutoUpdate = *changes.IsAutoUpdate
|
||||
}
|
||||
if changes.AutoLinkingOption != nil {
|
||||
o.AutoLinkingOption = *changes.AutoLinkingOption
|
||||
}
|
||||
}
|
||||
|
||||
func (o *OptionChanges) IsZero() bool {
|
||||
return o.IsCreationAllowed == nil && o.IsLinkingAllowed == nil && o.IsAutoCreation == nil && o.IsAutoUpdate == nil
|
||||
return o.IsCreationAllowed == nil && o.IsLinkingAllowed == nil && o.IsAutoCreation == nil && o.IsAutoUpdate == nil && o.AutoLinkingOption == nil
|
||||
}
|
||||
|
||||
type RemovedEvent struct {
|
||||
|
Reference in New Issue
Block a user