mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:07:30 +00:00
feat: organization settings for user uniqueness (#10246)
# Which Problems Are Solved Currently the username uniqueness is on instance level, we want to achieve a way to set it at organization level. # How the Problems Are Solved Addition of endpoints and a resource on organization level, where this setting can be managed. If nothing it set, the uniqueness is expected to be at instance level, where only users with instance permissions should be able to change this setting. # Additional Changes None # Additional Context Includes #10086 Closes #9964 --------- Co-authored-by: Marco A. <marco@zitadel.com>
This commit is contained in:
@@ -275,13 +275,13 @@ func OrgReactivatedEventMapper(event eventstore.Event) (eventstore.Event, error)
|
||||
}
|
||||
|
||||
type OrgRemovedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
name string
|
||||
usernames []string
|
||||
loginMustBeDomain bool
|
||||
domains []string
|
||||
externalIDPs []*domain.UserIDPLink
|
||||
samlEntityIDs []string
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
name string
|
||||
usernames []string
|
||||
organizationScopedUsernames bool
|
||||
domains []string
|
||||
externalIDPs []*domain.UserIDPLink
|
||||
samlEntityIDs []string
|
||||
}
|
||||
|
||||
func (e *OrgRemovedEvent) Payload() interface{} {
|
||||
@@ -293,7 +293,7 @@ func (e *OrgRemovedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||
NewRemoveOrgNameUniqueConstraint(e.name),
|
||||
}
|
||||
for _, name := range e.usernames {
|
||||
constraints = append(constraints, user.NewRemoveUsernameUniqueConstraint(name, e.Aggregate().ID, e.loginMustBeDomain))
|
||||
constraints = append(constraints, user.NewRemoveUsernameUniqueConstraint(name, e.Aggregate().ID, e.organizationScopedUsernames))
|
||||
}
|
||||
for _, domain := range e.domains {
|
||||
constraints = append(constraints, NewRemoveOrgDomainUniqueConstraint(domain))
|
||||
@@ -314,19 +314,19 @@ func (e *OrgRemovedEvent) Fields() []*eventstore.FieldOperation {
|
||||
}
|
||||
}
|
||||
|
||||
func NewOrgRemovedEvent(ctx context.Context, aggregate *eventstore.Aggregate, name string, usernames []string, loginMustBeDomain bool, domains []string, externalIDPs []*domain.UserIDPLink, samlEntityIDs []string) *OrgRemovedEvent {
|
||||
func NewOrgRemovedEvent(ctx context.Context, aggregate *eventstore.Aggregate, name string, usernames []string, organizationScopedUsernames bool, domains []string, externalIDPs []*domain.UserIDPLink, samlEntityIDs []string) *OrgRemovedEvent {
|
||||
return &OrgRemovedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgRemovedEventType,
|
||||
),
|
||||
name: name,
|
||||
usernames: usernames,
|
||||
domains: domains,
|
||||
externalIDPs: externalIDPs,
|
||||
samlEntityIDs: samlEntityIDs,
|
||||
loginMustBeDomain: loginMustBeDomain,
|
||||
name: name,
|
||||
usernames: usernames,
|
||||
domains: domains,
|
||||
externalIDPs: externalIDPs,
|
||||
samlEntityIDs: samlEntityIDs,
|
||||
organizationScopedUsernames: organizationScopedUsernames,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user