2023-03-28 22:09:06 +00:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
2023-10-10 13:20:53 +00:00
|
|
|
"context"
|
2024-10-31 14:57:17 +00:00
|
|
|
"time"
|
2024-04-03 10:43:43 +00:00
|
|
|
|
2024-10-31 14:57:17 +00:00
|
|
|
"github.com/go-jose/go-jose/v4"
|
2023-10-10 13:20:53 +00:00
|
|
|
"golang.org/x/text/language"
|
|
|
|
|
2024-10-31 14:57:17 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/api/authz"
|
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)
|
2024-09-06 13:11:36 +00:00
|
|
|
SMSProviderConfigActive(ctx context.Context, resourceOwner string) (config *query.SMSConfig, err error)
|
2024-04-11 07:16:10 +00:00
|
|
|
SMTPConfigActive(ctx context.Context, resourceOwner string) (*query.SMTPConfig, error)
|
2023-10-10 13:20:53 +00:00
|
|
|
GetDefaultLanguage(ctx context.Context) language.Tag
|
2023-12-05 11:12:01 +00:00
|
|
|
GetInstanceRestrictions(ctx context.Context) (restrictions query.Restrictions, err error)
|
2024-10-31 14:57:17 +00:00
|
|
|
InstanceByID(ctx context.Context, id string) (instance authz.Instance, err error)
|
|
|
|
GetActiveSigningWebKey(ctx context.Context) (*jose.JSONWebKey, error)
|
|
|
|
ActivePrivateSigningKey(ctx context.Context, t time.Time) (keys *query.PrivateKeys, err error)
|
2024-12-06 11:32:53 +00:00
|
|
|
|
|
|
|
ActiveInstances() []string
|
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,
|
|
|
|
}
|
|
|
|
}
|