2024-02-28 08:55:54 +00:00
|
|
|
package query
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/zitadel/zitadel/internal/domain"
|
|
|
|
"github.com/zitadel/zitadel/internal/feature"
|
|
|
|
)
|
|
|
|
|
|
|
|
type FeatureSource[T any] struct {
|
|
|
|
Level feature.Level
|
|
|
|
Value T
|
|
|
|
}
|
|
|
|
|
2024-05-24 11:32:57 +00:00
|
|
|
func (f *FeatureSource[T]) set(level feature.Level, value any) {
|
|
|
|
f.Level = level
|
|
|
|
f.Value = value.(T)
|
|
|
|
}
|
|
|
|
|
2024-02-28 08:55:54 +00:00
|
|
|
type SystemFeatures struct {
|
|
|
|
Details *domain.ObjectDetails
|
|
|
|
|
|
|
|
LoginDefaultOrg FeatureSource[bool]
|
|
|
|
TriggerIntrospectionProjections FeatureSource[bool]
|
|
|
|
LegacyIntrospection FeatureSource[bool]
|
2024-03-12 13:50:13 +00:00
|
|
|
UserSchema FeatureSource[bool]
|
2024-03-20 10:18:46 +00:00
|
|
|
TokenExchange FeatureSource[bool]
|
2024-04-09 17:21:21 +00:00
|
|
|
Actions FeatureSource[bool]
|
2024-05-24 11:32:57 +00:00
|
|
|
ImprovedPerformance FeatureSource[[]feature.ImprovedPerformanceType]
|
2024-09-04 10:14:50 +00:00
|
|
|
OIDCSingleV1SessionTermination FeatureSource[bool]
|
2024-09-26 13:55:41 +00:00
|
|
|
DisableUserTokenEvent FeatureSource[bool]
|
2024-02-28 08:55:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (q *Queries) GetSystemFeatures(ctx context.Context) (_ *SystemFeatures, err error) {
|
|
|
|
m := NewSystemFeaturesReadModel()
|
|
|
|
if err := q.eventstore.FilterToQueryReducer(ctx, m); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
m.system.Details = readModelToObjectDetails(m.ReadModel)
|
|
|
|
return m.system, nil
|
|
|
|
}
|