2024-02-28 08:55:54 +00:00
|
|
|
package query
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/zitadel/zitadel/internal/domain"
|
|
|
|
)
|
|
|
|
|
|
|
|
type InstanceFeatures 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-02-28 08:55:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (q *Queries) GetInstanceFeatures(ctx context.Context, cascade bool) (_ *InstanceFeatures, err error) {
|
|
|
|
var system *SystemFeatures
|
|
|
|
if cascade {
|
|
|
|
system, err = q.GetSystemFeatures(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m := NewInstanceFeaturesReadModel(ctx, system)
|
|
|
|
if err = q.eventstore.FilterToQueryReducer(ctx, m); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
m.instance.Details = readModelToObjectDetails(m.ReadModel)
|
|
|
|
return m.instance, nil
|
|
|
|
}
|