2022-03-24 17:21:34 +01:00
|
|
|
package instance
|
2021-06-10 13:49:10 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"golang.org/x/text/language"
|
|
|
|
|
2022-04-27 01:01:45 +02:00
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
|
|
"github.com/zitadel/zitadel/internal/repository/policy"
|
2021-06-10 13:49:10 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2022-03-24 17:21:34 +01:00
|
|
|
CustomTextSetEventType = instanceEventTypePrefix + policy.CustomTextSetEventType
|
|
|
|
CustomTextRemovedEventType = instanceEventTypePrefix + policy.CustomTextRemovedEventType
|
|
|
|
CustomTextTemplateRemovedEventType = instanceEventTypePrefix + policy.CustomTextTemplateRemovedEventType
|
2021-06-10 13:49:10 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
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),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-19 12:19:10 +02:00
|
|
|
func CustomTextSetEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
2021-06-10 13:49:10 +02:00
|
|
|
e, err := policy.CustomTextSetEventMapper(event)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return &CustomTextSetEvent{CustomTextSetEvent: *e.(*policy.CustomTextSetEvent)}, nil
|
|
|
|
}
|
2021-07-05 15:10:49 +02:00
|
|
|
|
|
|
|
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),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-19 12:19:10 +02:00
|
|
|
func CustomTextRemovedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
2021-07-05 15:10:49 +02:00
|
|
|
e, err := policy.CustomTextRemovedEventMapper(event)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return &CustomTextRemovedEvent{CustomTextRemovedEvent: *e.(*policy.CustomTextRemovedEvent)}, nil
|
|
|
|
}
|
feat(console): message and login texts, privacy policy (#2016)
* 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>
2021-07-26 12:44:45 +02:00
|
|
|
|
|
|
|
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,
|
|
|
|
),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-19 12:19:10 +02:00
|
|
|
func CustomTextTemplateRemovedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
feat(console): message and login texts, privacy policy (#2016)
* 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>
2021-07-26 12:44:45 +02:00
|
|
|
e, err := policy.CustomTextTemplateRemovedEventMapper(event)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return &CustomTextTemplateRemovedEvent{CustomTextTemplateRemovedEvent: *e.(*policy.CustomTextTemplateRemovedEvent)}, nil
|
|
|
|
}
|