mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +00:00
2e684684de
* message texts wrapper components * message-text sub, i18n, grid * fix routing * pack * pack * update material * audit * fix mgmt service for labelplcy * map conv * edit text from map * request map * fetch data, mgmt admin service * warn box, i18n * resetbtn * login texts * login text requests * reset, default, i18n * disabled, features, message text setter, service * locale switcher * policy grid * password reset, domain claimed i18n * lint files * fix admin service, i18n, lang setter * fix scss duplicate * privacy policy, cleanup grid, fix message, login texts (#2031) * policy grid everywhere 🦒 * cleanup home * log login text request * patch all data * refresh toggle * fix: add dialog for unsaved changes (#2057) * logintexts dialog * check for dialog on pairwise operation * fix: patch value to local state after save * fix: i18n and custom login texts (#2060) * fix: i18n and custom login texts * fix: tos and privacy texts * fix frontend * fix: tos and privacy texts and tests * fix: i18n, tos and privacy texts and tests * fix frontend maps * i18n * add ResetCustomLoginTextToDefault in admin api and fix template remove in handlers * resetlogintexttodefault Co-authored-by: Livio Amstutz <livio.a@gmail.com>
106 lines
2.7 KiB
Go
106 lines
2.7 KiB
Go
package iam
|
|
|
|
import (
|
|
"context"
|
|
|
|
"golang.org/x/text/language"
|
|
|
|
"github.com/caos/zitadel/internal/eventstore"
|
|
"github.com/caos/zitadel/internal/eventstore/repository"
|
|
"github.com/caos/zitadel/internal/repository/policy"
|
|
)
|
|
|
|
var (
|
|
CustomTextSetEventType = iamEventTypePrefix + policy.CustomTextSetEventType
|
|
CustomTextRemovedEventType = iamEventTypePrefix + policy.CustomTextRemovedEventType
|
|
CustomTextTemplateRemovedEventType = iamEventTypePrefix + policy.CustomTextTemplateRemovedEventType
|
|
)
|
|
|
|
type CustomTextSetEvent struct {
|
|
policy.CustomTextSetEvent
|
|
}
|
|
|
|
func NewCustomTextSetEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
template,
|
|
key,
|
|
text string,
|
|
language language.Tag,
|
|
) *CustomTextSetEvent {
|
|
return &CustomTextSetEvent{
|
|
CustomTextSetEvent: *policy.NewCustomTextSetEvent(
|
|
eventstore.NewBaseEventForPush(ctx, aggregate, CustomTextSetEventType),
|
|
template,
|
|
key,
|
|
text,
|
|
language),
|
|
}
|
|
}
|
|
|
|
func CustomTextSetEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
|
e, err := policy.CustomTextSetEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &CustomTextSetEvent{CustomTextSetEvent: *e.(*policy.CustomTextSetEvent)}, nil
|
|
}
|
|
|
|
type CustomTextRemovedEvent struct {
|
|
policy.CustomTextRemovedEvent
|
|
}
|
|
|
|
func NewCustomTextRemovedEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
template,
|
|
key string,
|
|
language language.Tag,
|
|
) *CustomTextRemovedEvent {
|
|
return &CustomTextRemovedEvent{
|
|
CustomTextRemovedEvent: *policy.NewCustomTextRemovedEvent(
|
|
eventstore.NewBaseEventForPush(ctx, aggregate, CustomTextRemovedEventType),
|
|
template,
|
|
key,
|
|
language),
|
|
}
|
|
}
|
|
|
|
func CustomTextRemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
|
e, err := policy.CustomTextRemovedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &CustomTextRemovedEvent{CustomTextRemovedEvent: *e.(*policy.CustomTextRemovedEvent)}, nil
|
|
}
|
|
|
|
type CustomTextTemplateRemovedEvent struct {
|
|
policy.CustomTextTemplateRemovedEvent
|
|
}
|
|
|
|
func NewCustomTextTemplateRemovedEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
template string,
|
|
language language.Tag,
|
|
) *CustomTextTemplateRemovedEvent {
|
|
return &CustomTextTemplateRemovedEvent{
|
|
CustomTextTemplateRemovedEvent: *policy.NewCustomTextTemplateRemovedEvent(
|
|
eventstore.NewBaseEventForPush(ctx, aggregate, CustomTextTemplateRemovedEventType),
|
|
template,
|
|
language,
|
|
),
|
|
}
|
|
}
|
|
|
|
func CustomTextTemplateRemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
|
e, err := policy.CustomTextTemplateRemovedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &CustomTextTemplateRemovedEvent{CustomTextTemplateRemovedEvent: *e.(*policy.CustomTextTemplateRemovedEvent)}, nil
|
|
}
|