feat: SMTP Templates (#6932)

* feat: smtp templates poc

* feat: add isActive & ProviderType to SMTP backend

* feat: change providertype to uint32 and fix tests

* feat: minimal smtp provider component

* feat: woking on diiferent providers

* feat: keep working on providers

* feat: initial stepper for new provider

* fix: settings list and working on stepper

* feat: step 1 and 2 form inputs

* feat: starter for smtp test step

* fix: misspelled SMPT

* fix: remove tests for now

* feat: add tls toggle remove old google provider

* feat: working on add smtp and table

* fix: duplicated identifiers

* fix: settings list

* fix: add missing smtp config properties

* fix: add configID to smtp config table

* fix: working on listproviders

* feat: working in listSMTPConfigs

* fix: add count to listsmtpconfigs

* fix: getting empty results from listSMTPConfigs

* feat: table now shows real data

* fix: remaining styles for smtp-table

* fix: remove old notification-smtp-provider-component

* feat: delete smtp configuration

* feat: deactivate smtp config

* feat: replace isActive with state for smtp config

* feat: activate smtp config

* fix: remaining errors after main merge

* fix: list smtp providers panic and material mdc

* feat: refactor to only one provider component

* feat: current provider details view

* fix: refactor AddSMTPConfig and ChangeSMTPConfig

* fix: smtp config reduce issue

* fix: recover domain in NewIAMSMTPConfigWriteModel

* fix: add code needed by SetUpInstance

* fix: go tests and warn about passing context to InstanceAggregateFromWriteModel

* fix: i18n and add missing trans for fr, it, zh

* fix: add e2e tests

* docs: add smtp templates

* fix: remove provider_type, add description

* fix: remaining error from merge main

* fix: add @stebenz change for primary key

* fix: inactive placed after removed to prevent deleted configs to show as inactive

* fix: smtp provider id can be empty (migrated)

* feat: add mailchimp transactional template

* feat: add Brevo (Sendinblue) template

* feat: change brevo logo, add color to tls icon

* fix: queries use resourceowner, id must not be empty

* fix: deal with old smtp settings and tests

* fix: resourceOwner is the instanceID

* fix: remove aggregate_id, rename SMTPConfigByAggregateID with SMTPConfigActive

* fix: add tests for multiple configs with different IDs

* fix: conflict

* fix: remove notification-smtp-provider

* fix: add @peintnermax suggestions, rename module and fix e2e tests

* fix: remove material legacy modules

* fix: remove ctx as parameter for  InstanceAggregateFromWriteModel

* fix: add Id to SMTPConfigToPb

* fix:  change InstanceAggregateFromWriteModel to avoid linter errors

* fix import

* rm unused package-lock

* update yarn lock

---------

Co-authored-by: Elio Bischof <elio@zitadel.com>
Co-authored-by: Max Peintner <max@caos.ch>
Co-authored-by: Stefan Benz <46600784+stebenz@users.noreply.github.com>
This commit is contained in:
Miguel Cabrerizo
2024-04-11 09:16:10 +02:00
committed by GitHub
parent e2f0cd034a
commit d229da6af7
93 changed files with 6359 additions and 6132 deletions

View File

@@ -381,8 +381,24 @@ service AdminService {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "SMTP";
summary: "Get SMTP Configuration";
description: "Returns the SMTP configuration from the system. This is used to send E-Mails to the users."
summary: "Get active SMTP Configuration";
description: "Returns the active SMTP configuration from the system. This is used to send E-Mails to the users."
};
}
rpc GetSMTPConfigById(GetSMTPConfigByIdRequest) returns (GetSMTPConfigByIdResponse) {
option (google.api.http) = {
get: "/smtp/{id}";
};
option (zitadel.v1.auth_option) = {
permission: "iam.read";
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "SMTP";
summary: "Get SMTP provider configuration by its id";
description: "Get a specific SMTP provider configuration by its ID.";
};
}
@@ -405,7 +421,7 @@ service AdminService {
rpc UpdateSMTPConfig(UpdateSMTPConfigRequest) returns (UpdateSMTPConfigResponse) {
option (google.api.http) = {
put: "/smtp";
put: "/smtp/{id}";
body: "*"
};
@@ -422,7 +438,7 @@ service AdminService {
rpc UpdateSMTPConfigPassword(UpdateSMTPConfigPasswordRequest) returns (UpdateSMTPConfigPasswordResponse) {
option (google.api.http) = {
put: "/smtp/password";
put: "/smtp/{id}/password";
body: "*"
};
@@ -437,9 +453,43 @@ service AdminService {
};
}
rpc ActivateSMTPConfig(ActivateSMTPConfigRequest) returns (ActivateSMTPConfigResponse) {
option (google.api.http) = {
post: "/smtp/{id}/_activate";
body: "*"
};
option (zitadel.v1.auth_option) = {
permission: "iam.write";
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "SMTP Provider";
summary: "Activate SMTP Provider";
description: "Activate an SMTP provider."
};
}
rpc DeactivateSMTPConfig(DeactivateSMTPConfigRequest) returns (DeactivateSMTPConfigResponse) {
option (google.api.http) = {
post: "/smtp/{id}/_deactivate";
body: "*"
};
option (zitadel.v1.auth_option) = {
permission: "iam.write";
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "SMTP Provider";
summary: "Deactivate SMTP Provider";
description: "Deactivate an SMTP provider. After deactivating the provider, the users will not be able to receive SMTP notifications from that provider anymore."
};
}
rpc RemoveSMTPConfig(RemoveSMTPConfigRequest) returns (RemoveSMTPConfigResponse) {
option (google.api.http) = {
delete: "/smtp";
delete: "/smtp/{id}";
};
option (zitadel.v1.auth_option) = {
@@ -453,6 +503,23 @@ service AdminService {
};
}
rpc ListSMTPConfigs(ListSMTPConfigsRequest) returns (ListSMTPConfigsResponse) {
option (google.api.http) = {
post: "/smtp/_search"
body: "*"
};
option (zitadel.v1.auth_option) = {
permission: "iam.read";
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "SMTP Configs";
summary: "List SMTP Configs";
description: "Returns a list of SMTP configurations."
};
}
rpc ListSMSProviders(ListSMSProvidersRequest) returns (ListSMSProvidersResponse) {
option (google.api.http) = {
post: "/sms/_search"
@@ -4007,6 +4074,23 @@ message GetSMTPConfigResponse {
zitadel.settings.v1.SMTPConfig smtp_config = 1;
}
message GetSMTPConfigByIdRequest {
string id = 1 [(validate.rules).string = {min_len: 1, max_len: 100}];
}
message GetSMTPConfigByIdResponse {
zitadel.settings.v1.SMTPConfig smtp_config = 1;
}
message ListSMTPConfigsRequest {
zitadel.v1.ListQuery query = 1;
}
message ListSMTPConfigsResponse {
zitadel.v1.ListDetails details = 1;
repeated zitadel.settings.v1.SMTPConfig result = 2;
}
message AddSMTPConfigRequest {
string sender_address = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
@@ -4051,7 +4135,15 @@ message AddSMTPConfigRequest {
(validate.rules).string = {min_len: 0, max_len: 200},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"replyto@m.zitadel.cloud\"";
min_length: 1;
min_length: 0;
max_length: 200;
}
];
string description = 8 [
(validate.rules).string = {min_len: 0, max_len: 200},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"provider description\"";
min_length: 0;
max_length: 200;
}
];
@@ -4059,6 +4151,7 @@ message AddSMTPConfigRequest {
message AddSMTPConfigResponse {
zitadel.v1.ObjectDetails details = 1;
string id = 2;
}
message UpdateSMTPConfigRequest {
@@ -4104,6 +4197,20 @@ message UpdateSMTPConfigRequest {
max_length: 200;
}
];
string password = 7 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"this-is-my-password\"";
}
];
string description = 8 [
(validate.rules).string = {min_len: 0, max_len: 200},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"provider description\"";
min_length: 1;
max_length: 200;
}
];
string id = 9 [(validate.rules).string = {min_len: 1, max_len: 100}];
}
message UpdateSMTPConfigResponse {
@@ -4116,14 +4223,32 @@ message UpdateSMTPConfigPasswordRequest {
example: "\"this-is-my-updated-password\"";
}
];
string id = 2 [(validate.rules).string = {min_len: 1, max_len: 100}];
}
message UpdateSMTPConfigPasswordResponse {
zitadel.v1.ObjectDetails details = 1;
}
//this is an empty request
message RemoveSMTPConfigRequest {}
message ActivateSMTPConfigRequest {
string id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
}
message ActivateSMTPConfigResponse {
zitadel.v1.ObjectDetails details = 1;
}
message DeactivateSMTPConfigRequest {
string id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
}
message DeactivateSMTPConfigResponse {
zitadel.v1.ObjectDetails details = 1;
}
message RemoveSMTPConfigRequest {
string id = 1 [(validate.rules).string = {min_len: 1, max_len: 100}];
}
message RemoveSMTPConfigResponse {
zitadel.v1.ObjectDetails details = 1;

View File

@@ -40,6 +40,12 @@ message SecretGeneratorTypeQuery {
SecretGeneratorType generator_type = 1;
}
enum SMTPConfigState {
SMTP_CONFIG_STATE_UNSPECIFIED = 0;
SMTP_CONFIG_ACTIVE = 1;
SMTP_CONFIG_INACTIVE = 2;
}
enum SecretGeneratorType {
SECRET_GENERATOR_TYPE_UNSPECIFIED = 0;
SECRET_GENERATOR_TYPE_INIT_CODE = 1;
@@ -80,6 +86,13 @@ message SMTPConfig {
example: "\"replyto@m.zitadel.cloud\"";
}
];
SMTPConfigState state = 8;
string description = 9 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"Mailjet\"";
}
];
string id = 10;
}
message SMSProvider {