2023-03-28 22:09:06 +00:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
2023-10-10 13:20:53 +00:00
|
|
|
"context"
|
|
|
|
"golang.org/x/text/language"
|
|
|
|
|
2023-03-28 22:09:06 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/crypto"
|
2023-10-10 13:20:53 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/domain"
|
2023-03-28 22:09:06 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
|
|
"github.com/zitadel/zitadel/internal/query"
|
|
|
|
)
|
|
|
|
|
2023-10-10 13:20:53 +00:00
|
|
|
type Queries interface {
|
|
|
|
ActiveLabelPolicyByOrg(ctx context.Context, orgID string, withOwnerRemoved bool) (*query.LabelPolicy, error)
|
|
|
|
MailTemplateByOrg(ctx context.Context, orgID string, withOwnerRemoved bool) (*query.MailTemplate, error)
|
2023-12-08 12:14:22 +00:00
|
|
|
GetNotifyUserByID(ctx context.Context, shouldTriggered bool, userID string) (*query.NotifyUser, error)
|
2023-10-10 13:20:53 +00:00
|
|
|
CustomTextListByTemplate(ctx context.Context, aggregateID, template string, withOwnerRemoved bool) (*query.CustomTexts, error)
|
|
|
|
SearchInstanceDomains(ctx context.Context, queries *query.InstanceDomainSearchQueries) (*query.InstanceDomains, error)
|
|
|
|
SessionByID(ctx context.Context, shouldTriggerBulk bool, id, sessionToken string) (*query.Session, error)
|
|
|
|
NotificationPolicyByOrg(ctx context.Context, shouldTriggerBulk bool, orgID string, withOwnerRemoved bool) (*query.NotificationPolicy, error)
|
|
|
|
SearchMilestones(ctx context.Context, instanceIDs []string, queries *query.MilestonesSearchQueries) (*query.Milestones, error)
|
|
|
|
NotificationProviderByIDAndType(ctx context.Context, aggID string, providerType domain.NotificationProviderType) (*query.DebugNotificationProvider, error)
|
|
|
|
SMSProviderConfig(ctx context.Context, queries ...query.SearchQuery) (*query.SMSConfig, error)
|
|
|
|
SMTPConfigByAggregateID(ctx context.Context, aggregateID string) (*query.SMTPConfig, error)
|
|
|
|
GetDefaultLanguage(ctx context.Context) language.Tag
|
2023-12-05 11:12:01 +00:00
|
|
|
GetInstanceRestrictions(ctx context.Context) (restrictions query.Restrictions, err error)
|
2023-10-10 13:20:53 +00:00
|
|
|
}
|
|
|
|
|
2023-03-28 22:09:06 +00:00
|
|
|
type NotificationQueries struct {
|
2023-10-10 13:20:53 +00:00
|
|
|
Queries
|
2023-03-28 22:09:06 +00:00
|
|
|
es *eventstore.Eventstore
|
2023-07-06 17:31:08 +00:00
|
|
|
externalDomain string
|
2023-03-28 22:09:06 +00:00
|
|
|
externalPort uint16
|
|
|
|
externalSecure bool
|
|
|
|
fileSystemPath string
|
|
|
|
UserDataCrypto crypto.EncryptionAlgorithm
|
|
|
|
SMTPPasswordCrypto crypto.EncryptionAlgorithm
|
|
|
|
SMSTokenCrypto crypto.EncryptionAlgorithm
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewNotificationQueries(
|
2023-10-10 13:20:53 +00:00
|
|
|
baseQueries Queries,
|
2023-03-28 22:09:06 +00:00
|
|
|
es *eventstore.Eventstore,
|
2023-07-06 17:31:08 +00:00
|
|
|
externalDomain string,
|
2023-03-28 22:09:06 +00:00
|
|
|
externalPort uint16,
|
|
|
|
externalSecure bool,
|
|
|
|
fileSystemPath string,
|
|
|
|
userDataCrypto crypto.EncryptionAlgorithm,
|
|
|
|
smtpPasswordCrypto crypto.EncryptionAlgorithm,
|
|
|
|
smsTokenCrypto crypto.EncryptionAlgorithm,
|
|
|
|
) *NotificationQueries {
|
|
|
|
return &NotificationQueries{
|
|
|
|
Queries: baseQueries,
|
|
|
|
es: es,
|
2023-07-06 17:31:08 +00:00
|
|
|
externalDomain: externalDomain,
|
2023-03-28 22:09:06 +00:00
|
|
|
externalPort: externalPort,
|
|
|
|
externalSecure: externalSecure,
|
|
|
|
fileSystemPath: fileSystemPath,
|
|
|
|
UserDataCrypto: userDataCrypto,
|
|
|
|
SMTPPasswordCrypto: smtpPasswordCrypto,
|
|
|
|
SMSTokenCrypto: smsTokenCrypto,
|
|
|
|
}
|
|
|
|
}
|