From fce3123b63c26e37a1c51963dc69867d3813a9ae Mon Sep 17 00:00:00 2001
From: cKey <35512826+colinin@users.noreply.github.com>
Date: Mon, 28 Mar 2022 11:32:05 +0800
Subject: [PATCH] feat: Use group isolation of Webhook definitions
---
.../Abp/Webhooks/IWebhookDefinitionContext.cs | 24 ++---
.../Abp/Webhooks/IWebhookDefinitionManager.cs | 6 ++
.../Abp/Webhooks/WebhookDefinitionContext.cs | 35 +++---
.../Abp/Webhooks/WebhookDefinitionManager.cs | 30 ++++++
.../Abp/Webhooks/WebhookGroupDefinition.cs | 101 ++++++++++++++++++
.../FodyWeavers.xml | 2 +-
.../Identity/IdentityRoleWebHooker.cs | 5 +-
.../Identity/IdentityUserWebHooker.cs | 4 +-
.../IdentityWebhookDefinitionProvider.cs | 8 +-
.../Webhooks/Identity/IdentityWebhookNames.cs | 2 +-
.../Identity/Localization/Resources/en.json | 1 +
.../Localization/Resources/zh-Hans.json | 1 +
.../Identity/OrganizationUnitWebHooker.cs | 4 +-
.../LINGYUN.Abp.Webhooks.Saas/FodyWeavers.xml | 3 +
.../LINGYUN.Abp.Webhooks.Saas/FodyWeavers.xsd | 30 ++++++
.../LINGYUN.Abp.Webhooks.Saas.csproj | 30 ++++++
.../Webhooks/Saas/AbpWebhooksSaasModule.cs | 30 ++++++
.../Abp/Webhooks/Saas/EditionWebhooker.cs | 48 +++++++++
.../LINGYUN/Abp/Webhooks/Saas/EditionWto.cs | 11 ++
.../Saas/Localization/Resources/en.json | 18 ++++
.../Saas/Localization/Resources/zh-Hans.json | 18 ++++
.../Saas/SaasWebhookDefinitionProvider.cs | 60 +++++++++++
.../Abp/Webhooks/Saas/SaasWebhookNames.cs | 21 ++++
.../Abp/Webhooks/Saas/TenantWebhooker.cs | 48 +++++++++
.../LINGYUN/Abp/Webhooks/Saas/TenantWto.cs | 12 +++
.../IWebhookSubscriptionAppService.cs | 2 +-
.../WebhookAvailableGroupDto.cs | 10 ++
.../WebhookSubscriptionAppService.cs | 33 ++++--
.../Localization/Resources/en.json | 7 +-
.../Localization/Resources/zh-Hans.json | 7 +-
.../Webhooks/WebhooksDefinitionProvider.cs | 10 +-
.../Webhooks/WebhooksNames.cs | 4 +-
.../WebhookSubscriptionController.cs | 2 +-
...ice.WebhooksManagement.HttpApi.Host.csproj | 1 +
.../WebhooksManagementHttpApiHostModule.cs | 2 +
35 files changed, 565 insertions(+), 65 deletions(-)
create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookGroupDefinition.cs
create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/FodyWeavers.xml
create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/FodyWeavers.xsd
create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN.Abp.Webhooks.Saas.csproj
create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/AbpWebhooksSaasModule.cs
create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/EditionWebhooker.cs
create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/EditionWto.cs
create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/Localization/Resources/en.json
create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/Localization/Resources/zh-Hans.json
create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/SaasWebhookDefinitionProvider.cs
create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/SaasWebhookNames.cs
create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/TenantWebhooker.cs
create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/TenantWto.cs
create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookAvailableGroupDto.cs
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/IWebhookDefinitionContext.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/IWebhookDefinitionContext.cs
index 328c214bd..c170ede3d 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/IWebhookDefinitionContext.cs
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/IWebhookDefinitionContext.cs
@@ -1,22 +1,16 @@
-namespace LINGYUN.Abp.Webhooks
+using JetBrains.Annotations;
+using Volo.Abp.Localization;
+
+namespace LINGYUN.Abp.Webhooks
{
public interface IWebhookDefinitionContext
{
- ///
- /// Adds the specified webhook definition. Throws exception if it is already added
- ///
- void Add(params WebhookDefinition[] definitions);
+ WebhookGroupDefinition AddGroup(
+ [NotNull] string name,
+ ILocalizableString displayName = null);
- ///
- /// Gets a webhook definition by name.
- /// Returns null if there is no webhook definition with given name.
- ///
- WebhookDefinition GetOrNull(string name);
+ WebhookGroupDefinition GetGroupOrNull(string name);
- ///
- /// Remove webhook with given name
- ///
- /// webhook definition name
- void Remove(string name);
+ void RemoveGroup(string name);
}
}
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/IWebhookDefinitionManager.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/IWebhookDefinitionManager.cs
index 057b0b984..a284ab693 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/IWebhookDefinitionManager.cs
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/IWebhookDefinitionManager.cs
@@ -23,6 +23,12 @@ namespace LINGYUN.Abp.Webhooks
///
IReadOnlyList GetAll();
+ ///
+ /// Gets all webhook group definitions.
+ ///
+ ///
+ IReadOnlyList GetGroups();
+
///
/// Checks if given webhook name is available for given tenant.
///
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookDefinitionContext.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookDefinitionContext.cs
index 4176fc785..5e8987a8b 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookDefinitionContext.cs
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookDefinitionContext.cs
@@ -7,48 +7,49 @@ namespace LINGYUN.Abp.Webhooks
{
public class WebhookDefinitionContext : IWebhookDefinitionContext
{
- protected Dictionary Webhooks { get; }
+ protected Dictionary Groups { get; }
- public WebhookDefinitionContext(Dictionary webhooks)
+ public WebhookDefinitionContext(Dictionary webhooks)
{
- Webhooks = webhooks;
+ Groups = webhooks;
}
- public void Add(params WebhookDefinition[] definitions)
+ public WebhookGroupDefinition AddGroup(
+ [NotNull] string name,
+ ILocalizableString displayName = null)
{
- if (definitions.IsNullOrEmpty())
- {
- return;
- }
+ Check.NotNull(name, nameof(name));
- foreach (var definition in definitions)
+ if (Groups.ContainsKey(name))
{
- Webhooks[definition.Name] = definition;
+ throw new AbpException($"There is already an existing webhook group with name: {name}");
}
+
+ return Groups[name] = new WebhookGroupDefinition(name, displayName);
}
- public WebhookDefinition GetOrNull([NotNull] string name)
+ public WebhookGroupDefinition GetGroupOrNull([NotNull] string name)
{
Check.NotNull(name, nameof(name));
- if (!Webhooks.ContainsKey(name))
+ if (!Groups.ContainsKey(name))
{
return null;
}
- return Webhooks[name];
+ return Groups[name];
}
- public void Remove(string name)
+ public void RemoveGroup(string name)
{
Check.NotNull(name, nameof(name));
- if (!Webhooks.ContainsKey(name))
+ if (!Groups.ContainsKey(name))
{
- throw new AbpException($"Undefined notification webhook: '{name}'.");
+ throw new AbpException($"Undefined notification webhook group: '{name}'.");
}
- Webhooks.Remove(name);
+ Groups.Remove(name);
}
}
}
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookDefinitionManager.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookDefinitionManager.cs
index bf70017be..c0f96f20e 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookDefinitionManager.cs
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookDefinitionManager.cs
@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading.Tasks;
+using Volo.Abp;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Features;
using Volo.Abp.MultiTenancy;
@@ -13,6 +14,9 @@ namespace LINGYUN.Abp.Webhooks
{
internal class WebhookDefinitionManager : IWebhookDefinitionManager, ISingletonDependency
{
+ protected IDictionary WebhookGroupDefinitions => _lazyWebhookGroupDefinitions.Value;
+ private readonly Lazy> _lazyWebhookGroupDefinitions;
+
protected IDictionary WebhookDefinitions => _lazyWebhookDefinitions.Value;
private readonly Lazy> _lazyWebhookDefinitions;
@@ -26,6 +30,7 @@ namespace LINGYUN.Abp.Webhooks
_serviceProvider = serviceProvider;
_options = options.Value;
+ _lazyWebhookGroupDefinitions = new Lazy>(CreateWebhookGroupDefinitions);
_lazyWebhookDefinitions = new Lazy>(CreateWebhookDefinitions);
}
@@ -54,6 +59,11 @@ namespace LINGYUN.Abp.Webhooks
return WebhookDefinitions.Values.ToImmutableList();
}
+ public IReadOnlyList GetGroups()
+ {
+ return WebhookGroupDefinitions.Values.ToImmutableList();
+ }
+
public async Task IsAvailableAsync(Guid? tenantId, string name)
{
if (tenantId == null) // host allowed to subscribe all webhooks
@@ -90,6 +100,26 @@ namespace LINGYUN.Abp.Webhooks
{
var definitions = new Dictionary();
+ foreach (var groupDefinition in WebhookGroupDefinitions.Values)
+ {
+ foreach (var webhook in groupDefinition.Webhooks)
+ {
+ if (definitions.ContainsKey(webhook.Name))
+ {
+ throw new AbpException("Duplicate webhook name: " + webhook.Name);
+ }
+
+ definitions[webhook.Name] = webhook;
+ }
+ }
+
+ return definitions;
+ }
+
+ protected virtual Dictionary CreateWebhookGroupDefinitions()
+ {
+ var definitions = new Dictionary();
+
using (var scope = _serviceProvider.CreateScope())
{
var providers = _options
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookGroupDefinition.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookGroupDefinition.cs
new file mode 100644
index 000000000..ae58049ed
--- /dev/null
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebHooks/LINGYUN/Abp/Webhooks/WebhookGroupDefinition.cs
@@ -0,0 +1,101 @@
+using JetBrains.Annotations;
+using System.Collections.Generic;
+using System.Collections.Immutable;
+using System.Linq;
+using Volo.Abp;
+using Volo.Abp.Localization;
+
+namespace LINGYUN.Abp.Webhooks;
+
+public class WebhookGroupDefinition
+{
+ [NotNull]
+ public string Name { get; set; }
+ public Dictionary Properties { get; }
+
+ private ILocalizableString _displayName;
+ public ILocalizableString DisplayName
+ {
+ get {
+ return _displayName;
+ }
+ set {
+ _displayName = value;
+ }
+ }
+
+ public IReadOnlyList Webhooks => _webhooks.ToImmutableList();
+ private readonly List _webhooks;
+ public object this[string name] {
+ get => Properties.GetOrDefault(name);
+ set => Properties[name] = value;
+ }
+
+ protected internal WebhookGroupDefinition(
+ string name,
+ ILocalizableString displayName = null)
+ {
+ Name = name;
+ DisplayName = displayName ?? new FixedLocalizableString(Name);
+
+ Properties = new Dictionary();
+ _webhooks = new List();
+ }
+
+ public virtual WebhookDefinition AddWebhook(
+ string name,
+ ILocalizableString displayName = null,
+ ILocalizableString description = null)
+ {
+ if (Webhooks.Any(hook => hook.Name.Equals(name)))
+ {
+ throw new AbpException($"There is already an existing webhook with name: {name} in group {Name}");
+ }
+
+ var webhook = new WebhookDefinition(
+ name,
+ displayName,
+ description
+ );
+
+ _webhooks.Add(webhook);
+
+ return webhook;
+ }
+
+ public virtual void AddWebhooks(params WebhookDefinition[] webhooks)
+ {
+ foreach (var webhook in webhooks)
+ {
+ if (Webhooks.Any(hook => hook.Name.Equals(webhook.Name)))
+ {
+ throw new AbpException($"There is already an existing webhook with name: {webhook.Name} in group {Name}");
+ }
+ }
+
+ _webhooks.AddRange(webhooks);
+ }
+
+
+
+ [CanBeNull]
+ public WebhookDefinition GetWebhookOrNull([NotNull] string name)
+ {
+ Check.NotNull(name, nameof(name));
+
+ foreach (var webhook in Webhooks)
+ {
+ if (webhook.Name == name)
+ {
+ return webhook;
+ }
+ }
+
+ return null;
+ }
+
+ public override string ToString()
+ {
+ return $"[{nameof(WebhookGroupDefinition)} {Name}]";
+ }
+}
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/FodyWeavers.xml b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/FodyWeavers.xml
index ac6b5b292..c485a4548 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/FodyWeavers.xml
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/FodyWeavers.xml
@@ -1,3 +1,3 @@
-
+
\ No newline at end of file
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityRoleWebHooker.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityRoleWebHooker.cs
index ee1fdaee6..5d60012c0 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityRoleWebHooker.cs
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityRoleWebHooker.cs
@@ -6,15 +6,16 @@ using Volo.Abp.Identity;
namespace LINGYUN.Abp.Webhooks.Identity;
-public class IdentityRoleWebHooker :
+public class IdentityRoleWebhooker :
IDistributedEventHandler>,
IDistributedEventHandler>,
+ IDistributedEventHandler>,
IDistributedEventHandler,
ITransientDependency
{
private readonly IWebhookPublisher _webhookPublisher;
- public IdentityRoleWebHooker(
+ public IdentityRoleWebhooker(
IWebhookPublisher webhookPublisher)
{
_webhookPublisher = webhookPublisher;
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityUserWebHooker.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityUserWebHooker.cs
index fc48c2cab..7dc188cf5 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityUserWebHooker.cs
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityUserWebHooker.cs
@@ -6,7 +6,7 @@ using Volo.Abp.Users;
namespace LINGYUN.Abp.Webhooks.Identity;
-public class IdentityUserWebHooker :
+public class IdentityUserWebhooker :
IDistributedEventHandler>,
IDistributedEventHandler>,
IDistributedEventHandler>,
@@ -14,7 +14,7 @@ public class IdentityUserWebHooker :
{
private readonly IWebhookPublisher _webhookPublisher;
- public IdentityUserWebHooker(
+ public IdentityUserWebhooker(
IWebhookPublisher webhookPublisher)
{
_webhookPublisher = webhookPublisher;
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityWebhookDefinitionProvider.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityWebhookDefinitionProvider.cs
index 4e5745b06..6c243b942 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityWebhookDefinitionProvider.cs
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityWebhookDefinitionProvider.cs
@@ -7,8 +7,12 @@ public class IdentityWebhookDefinitionProvider : WebhookDefinitionProvider
{
public override void Define(IWebhookDefinitionContext context)
{
- context.Add(CreateIdentityRoleWebhooks());
- context.Add(CreateIdentityUserWebhooks());
+ var identityGroup = context.AddGroup(
+ IdentityWebhookNames.GroupName,
+ L("Webhooks:Identity"));
+
+ identityGroup.AddWebhooks(CreateIdentityRoleWebhooks());
+ identityGroup.AddWebhooks(CreateIdentityUserWebhooks());
}
protected virtual WebhookDefinition[] CreateIdentityRoleWebhooks()
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityWebhookNames.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityWebhookNames.cs
index a190f8692..be7fa0232 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityWebhookNames.cs
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/IdentityWebhookNames.cs
@@ -2,7 +2,7 @@
public static class IdentityWebhookNames
{
- public const string GroupName = "abp.identity";
+ public const string GroupName = "abp.webhooks.identity";
public static class IdentityRole
{
public const string Prefix = GroupName + ".roles";
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/Localization/Resources/en.json b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/Localization/Resources/en.json
index 9687bcf0e..05df4003d 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/Localization/Resources/en.json
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/Localization/Resources/en.json
@@ -1,6 +1,7 @@
{
"culture": "en",
"texts": {
+ "Webhooks:Identity": "Identity",
"Webhooks:CreateRole": "Create Role",
"Webhooks:CreateRoleDesc": "A new role has been created",
"Webhooks:UpdateRole": "Update Role",
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/Localization/Resources/zh-Hans.json b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/Localization/Resources/zh-Hans.json
index 853a91b01..eb06d0489 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/Localization/Resources/zh-Hans.json
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/Localization/Resources/zh-Hans.json
@@ -1,6 +1,7 @@
{
"culture": "zh-Hans",
"texts": {
+ "Webhooks:Identity": "身份认证",
"Webhooks:CreateRole": "创建角色",
"Webhooks:CreateRoleDesc": "一个新角色已创建",
"Webhooks:UpdateRole": "编辑角色",
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/OrganizationUnitWebHooker.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/OrganizationUnitWebHooker.cs
index fb7e30913..a259bc16b 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/OrganizationUnitWebHooker.cs
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Identity/LINGYUN/Abp/Webhooks/Identity/OrganizationUnitWebHooker.cs
@@ -6,7 +6,7 @@ using Volo.Abp.Identity;
namespace LINGYUN.Abp.Webhooks.Identity;
-public class OrganizationUnitWebHooker :
+public class OrganizationUnitWebhooker :
IDistributedEventHandler>,
IDistributedEventHandler>,
IDistributedEventHandler>,
@@ -14,7 +14,7 @@ public class OrganizationUnitWebHooker :
{
private readonly IWebhookPublisher _webhookPublisher;
- public OrganizationUnitWebHooker(
+ public OrganizationUnitWebhooker(
IWebhookPublisher webhookPublisher)
{
_webhookPublisher = webhookPublisher;
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/FodyWeavers.xml b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/FodyWeavers.xml
new file mode 100644
index 000000000..c485a4548
--- /dev/null
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/FodyWeavers.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/FodyWeavers.xsd b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/FodyWeavers.xsd
new file mode 100644
index 000000000..11da52550
--- /dev/null
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/FodyWeavers.xsd
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
+
+
+
+
+ A comma-separated list of error codes that can be safely ignored in assembly verification.
+
+
+
+
+ 'false' to turn off automatic generation of the XML Schema file.
+
+
+
+
+
\ No newline at end of file
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN.Abp.Webhooks.Saas.csproj b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN.Abp.Webhooks.Saas.csproj
new file mode 100644
index 000000000..66d9fa1b8
--- /dev/null
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN.Abp.Webhooks.Saas.csproj
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+ netstandard2.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/AbpWebhooksSaasModule.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/AbpWebhooksSaasModule.cs
new file mode 100644
index 000000000..93567e45a
--- /dev/null
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/AbpWebhooksSaasModule.cs
@@ -0,0 +1,30 @@
+using LINGYUN.Abp.Saas;
+using LINGYUN.Abp.Saas.Localization;
+using Volo.Abp.Domain;
+using Volo.Abp.EventBus;
+using Volo.Abp.Localization;
+using Volo.Abp.Modularity;
+using Volo.Abp.VirtualFileSystem;
+
+namespace LINGYUN.Abp.Webhooks.Saas;
+
+[DependsOn(typeof(AbpDddDomainModule))]
+[DependsOn(typeof(AbpEventBusModule))]
+[DependsOn(typeof(AbpSaasDomainSharedModule))]
+public class AbpWebhooksSaasModule : AbpModule
+{
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ Configure(options =>
+ {
+ options.FileSets.AddEmbedded();
+ });
+
+ Configure(options =>
+ {
+ options.Resources
+ .Get()
+ .AddVirtualJson("/LINGYUN/Abp/Webhooks/Saas/Localization/Resources");
+ });
+ }
+}
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/EditionWebhooker.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/EditionWebhooker.cs
new file mode 100644
index 000000000..fffdd0328
--- /dev/null
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/EditionWebhooker.cs
@@ -0,0 +1,48 @@
+using LINGYUN.Abp.Saas.Editions;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Domain.Entities.Events.Distributed;
+using Volo.Abp.EventBus.Distributed;
+
+namespace LINGYUN.Abp.Webhooks.Saas;
+
+public class EditionWebhooker :
+ IDistributedEventHandler>,
+ IDistributedEventHandler>,
+ IDistributedEventHandler>,
+ ITransientDependency
+{
+ private readonly IWebhookPublisher _webhookPublisher;
+
+ public EditionWebhooker(
+ IWebhookPublisher webhookPublisher)
+ {
+ _webhookPublisher = webhookPublisher;
+ }
+
+ public async virtual Task HandleEventAsync(EntityCreatedEto eventData)
+ {
+ await PublishAsync(SaasWebhookNames.Edition.Create, eventData.Entity);
+ }
+
+ public async virtual Task HandleEventAsync(EntityUpdatedEto eventData)
+ {
+ await PublishAsync(SaasWebhookNames.Edition.Update, eventData.Entity);
+ }
+
+ public async virtual Task HandleEventAsync(EntityDeletedEto eventData)
+ {
+ await PublishAsync(SaasWebhookNames.Edition.Delete, eventData.Entity);
+ }
+
+ protected async virtual Task PublishAsync(string webhookName, EditionEto eto)
+ {
+ await _webhookPublisher.PublishAsync(
+ webhookName,
+ new EditionWto
+ {
+ Id = eto.Id,
+ DisplayName = eto.DisplayName
+ });
+ }
+}
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/EditionWto.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/EditionWto.cs
new file mode 100644
index 000000000..8a3a1208b
--- /dev/null
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/EditionWto.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace LINGYUN.Abp.Webhooks.Saas;
+
+[Serializable]
+public class EditionWto
+{
+ public Guid Id { get; set; }
+
+ public string DisplayName { get; set; }
+}
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/Localization/Resources/en.json b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/Localization/Resources/en.json
new file mode 100644
index 000000000..fdafcd2d1
--- /dev/null
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/Localization/Resources/en.json
@@ -0,0 +1,18 @@
+{
+ "culture": "en",
+ "texts": {
+ "Webhooks:Saas": "Saas",
+ "Webhooks:CreateEdition": "Create Edition",
+ "Webhooks:CreateEditionDesc": "A new Edition has been created",
+ "Webhooks:UpdateEdition": "Update Edition",
+ "Webhooks:UpdateEditionDesc": "A Edition has changed",
+ "Webhooks:DeleteEdition": "Delete Edition",
+ "Webhooks:DeleteEditionDesc": "Deleted Edition",
+ "Webhooks:CreateTenant": "Create Tenant",
+ "Webhooks:CreateTenantDesc": "A new Tenant has been created",
+ "Webhooks:UpdateTenant": "Update Tenant",
+ "Webhooks:UpdateTenantDesc": "A Tenant has been changed",
+ "Webhooks:DeleteTenant": "Delete Tenant",
+ "Webhooks:DeleteTenantDesc": "Deleted Tenant"
+ }
+}
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/Localization/Resources/zh-Hans.json b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/Localization/Resources/zh-Hans.json
new file mode 100644
index 000000000..fd5ddbf30
--- /dev/null
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/Localization/Resources/zh-Hans.json
@@ -0,0 +1,18 @@
+{
+ "culture": "zh-Hans",
+ "texts": {
+ "Webhooks:Saas": "Saas",
+ "Webhooks:CreateEdition": "创建版本",
+ "Webhooks:CreateEditionDesc": "一个新版本已创建",
+ "Webhooks:UpdateEdition": "编辑版本",
+ "Webhooks:UpdateEditionDesc": "一个版本属性已变更",
+ "Webhooks:DeleteEdition": "删除版本",
+ "Webhooks:DeleteEditionDesc": "已删除版本",
+ "Webhooks:CreateTenant": "创建租户",
+ "Webhooks:CreateTenantDesc": "一个新租户已创建",
+ "Webhooks:UpdateTenant": "编辑租户",
+ "Webhooks:UpdateTenantDesc": "一个租户属性已变更",
+ "Webhooks:DeleteTenant": "删除租户",
+ "Webhooks:DeleteTenantDesc": "已删除租户"
+ }
+}
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/SaasWebhookDefinitionProvider.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/SaasWebhookDefinitionProvider.cs
new file mode 100644
index 000000000..b2624f179
--- /dev/null
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/SaasWebhookDefinitionProvider.cs
@@ -0,0 +1,60 @@
+using LINGYUN.Abp.Saas.Localization;
+using Volo.Abp.Localization;
+
+namespace LINGYUN.Abp.Webhooks.Saas;
+
+public class SaasWebhookDefinitionProvider : WebhookDefinitionProvider
+{
+ public override void Define(IWebhookDefinitionContext context)
+ {
+ var saasGroup = context.AddGroup(
+ SaasWebhookNames.GroupName,
+ L("Webhooks:Saas"));
+
+ saasGroup.AddWebhooks(CreateEditionWebhooks());
+ saasGroup.AddWebhooks(CreateTenantWebhooks());
+ }
+
+ protected virtual WebhookDefinition[] CreateEditionWebhooks()
+ {
+ return new[]
+ {
+ new WebhookDefinition(
+ SaasWebhookNames.Edition.Create,
+ L("Webhooks:CreateEdition"),
+ L("Webhooks:CreateEditionDesc")),
+ new WebhookDefinition(
+ SaasWebhookNames.Edition.Update,
+ L("Webhooks:UpdateEdition"),
+ L("Webhooks:UpdateEditionDesc")),
+ new WebhookDefinition(
+ SaasWebhookNames.Edition.Delete,
+ L("Webhooks:DeleteEdition"),
+ L("Webhooks:DeleteEditionDesc")),
+ };
+ }
+
+ protected virtual WebhookDefinition[] CreateTenantWebhooks()
+ {
+ return new[]
+ {
+ new WebhookDefinition(
+ SaasWebhookNames.Tenant.Create,
+ L("Webhooks:CreateTenant"),
+ L("Webhooks:CreateTenantDesc")),
+ new WebhookDefinition(
+ SaasWebhookNames.Tenant.Update,
+ L("Webhooks:UpdateTenant"),
+ L("Webhooks:UpdateTenantDesc")),
+ new WebhookDefinition(
+ SaasWebhookNames.Tenant.Delete,
+ L("Webhooks:DeleteTenant"),
+ L("Webhooks:DeleteTenantDesc")),
+ };
+ }
+
+ private static ILocalizableString L(string name)
+ {
+ return LocalizableString.Create(name);
+ }
+}
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/SaasWebhookNames.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/SaasWebhookNames.cs
new file mode 100644
index 000000000..399903fc6
--- /dev/null
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/SaasWebhookNames.cs
@@ -0,0 +1,21 @@
+namespace LINGYUN.Abp.Webhooks.Saas;
+
+public static class SaasWebhookNames
+{
+ public const string GroupName = "abp.webhooks.saas";
+ public static class Edition
+ {
+ public const string Prefix = GroupName + ".editions";
+ public const string Create = Prefix + ".create";
+ public const string Update = Prefix + ".update";
+ public const string Delete = Prefix + ".delete";
+ }
+
+ public static class Tenant
+ {
+ public const string Prefix = GroupName + ".tenants";
+ public const string Create = Prefix + ".create";
+ public const string Update = Prefix + ".update";
+ public const string Delete = Prefix + ".delete";
+ }
+}
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/TenantWebhooker.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/TenantWebhooker.cs
new file mode 100644
index 000000000..916fd8f3b
--- /dev/null
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/TenantWebhooker.cs
@@ -0,0 +1,48 @@
+using LINGYUN.Abp.Saas.Tenants;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Domain.Entities.Events.Distributed;
+using Volo.Abp.EventBus.Distributed;
+
+namespace LINGYUN.Abp.Webhooks.Saas;
+
+public class TenantWebhooker :
+ IDistributedEventHandler>,
+ IDistributedEventHandler>,
+ IDistributedEventHandler>,
+ ITransientDependency
+{
+ private readonly IWebhookPublisher _webhookPublisher;
+
+ public TenantWebhooker(
+ IWebhookPublisher webhookPublisher)
+ {
+ _webhookPublisher = webhookPublisher;
+ }
+
+ public async virtual Task HandleEventAsync(EntityCreatedEto eventData)
+ {
+ await PublishAsync(SaasWebhookNames.Tenant.Create, eventData.Entity);
+ }
+
+ public async virtual Task HandleEventAsync(EntityUpdatedEto eventData)
+ {
+ await PublishAsync(SaasWebhookNames.Tenant.Update, eventData.Entity);
+ }
+
+ public async virtual Task HandleEventAsync(EntityDeletedEto eventData)
+ {
+ await PublishAsync(SaasWebhookNames.Tenant.Delete, eventData.Entity);
+ }
+
+ protected async virtual Task PublishAsync(string webhookName, TenantEto eto)
+ {
+ await _webhookPublisher.PublishAsync(
+ webhookName,
+ new TenantWto
+ {
+ Id = eto.Id,
+ Name = eto.Name
+ });
+ }
+}
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/TenantWto.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/TenantWto.cs
new file mode 100644
index 000000000..ba2d4ef0d
--- /dev/null
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Saas/LINGYUN/Abp/Webhooks/Saas/TenantWto.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace LINGYUN.Abp.Webhooks.Saas;
+
+[Serializable]
+public class TenantWto
+{
+ public Guid Id { get; set; }
+
+ public string Name { get; set; }
+}
+
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhookSubscriptionAppService.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhookSubscriptionAppService.cs
index 1de23c039..132fcbd73 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhookSubscriptionAppService.cs
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhookSubscriptionAppService.cs
@@ -13,5 +13,5 @@ public interface IWebhookSubscriptionAppService :
WebhookSubscriptionCreateInput,
WebhookSubscriptionUpdateInput>
{
- Task> GetAllAvailableWebhooksAsync();
+ Task> GetAllAvailableWebhooksAsync();
}
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookAvailableGroupDto.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookAvailableGroupDto.cs
new file mode 100644
index 000000000..37a3c8fe1
--- /dev/null
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookAvailableGroupDto.cs
@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+
+namespace LINGYUN.Abp.WebhooksManagement;
+
+public class WebhookAvailableGroupDto
+{
+ public string Name { get; set; }
+ public string DisplayName { get; set; }
+ public List Webhooks { get; set; } = new List();
+}
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs
index a59b2e84e..3b140c91b 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs
@@ -103,25 +103,36 @@ public class WebhookSubscriptionAppService : WebhooksManagementAppServiceBase, I
return subscription.ToWebhookSubscriptionDto();
}
- public async virtual Task> GetAllAvailableWebhooksAsync()
+ public async virtual Task> GetAllAvailableWebhooksAsync()
{
- var webhooks = WebhookDefinitionManager.GetAll();
- var definitions = new List();
+ var groups = WebhookDefinitionManager.GetGroups();
+ var definitions = new List();
- foreach (var webhookDefinition in webhooks)
+ foreach (var groupDefinition in groups)
{
- if (await WebhookDefinitionManager.IsAvailableAsync(CurrentTenant.Id, webhookDefinition.Name))
+ var group = new WebhookAvailableGroupDto
{
- definitions.Add(new WebhookAvailableDto
+ Name = groupDefinition.Name,
+ DisplayName = groupDefinition.DisplayName?.Localize(StringLocalizerFactory),
+ };
+
+ foreach (var webhookDefinition in groupDefinition.Webhooks.OrderBy(d => d.Name))
+ {
+ if (await WebhookDefinitionManager.IsAvailableAsync(CurrentTenant.Id, webhookDefinition.Name))
{
- Name = webhookDefinition.Name,
- Description = webhookDefinition.Description?.Localize(StringLocalizerFactory),
- DisplayName = webhookDefinition.DisplayName?.Localize(StringLocalizerFactory)
- });
+ group.Webhooks.Add(new WebhookAvailableDto
+ {
+ Name = webhookDefinition.Name,
+ Description = webhookDefinition.Description?.Localize(StringLocalizerFactory),
+ DisplayName = webhookDefinition.DisplayName?.Localize(StringLocalizerFactory)
+ });
+ }
}
+
+ definitions.Add(group);
}
- return new ListResultDto(definitions.OrderBy(d => d.Name).ToList());
+ return new ListResultDto(definitions.OrderBy(d => d.Name).ToList());
}
protected async virtual Task CheckSubscribedAsync(WebhookSubscriptionCreateOrUpdateInput input)
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json
index b3828f603..a64f32f2a 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json
@@ -11,8 +11,9 @@
"Permission:Resend": "Resend",
"Permission:Publish": "Publish",
"Permission:ManageSettings": "Manage Settings",
- "DisplayName:CheckConnect": "Check Connect",
- "Description:CheckConnect": "When a third-party service is connected, it is used to check whether the communication is normal.",
- "Webhooks:010001": "Payload address {WebhookUri} has been mounted event {Webhooks}!"
+ "Webhooks:010001": "Payload address {WebhookUri} has been mounted event {Webhooks}!",
+ "Webhooks:Tests": "Tests",
+ "Webhooks:CheckConnect": "Check Connect",
+ "Webhooks:CheckConnectDesc": "When a third-party service is connected, it is used to check whether the communication is normal."
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json
index d20d0efdd..efb4975cd 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json
@@ -11,8 +11,9 @@
"Permission:Resend": "重新发送",
"Permission:Publish": "发布事件",
"Permission:ManageSettings": "管理设置",
- "DisplayName:CheckConnect": "检查连接",
- "Description:CheckConnect": "第三方服务接入时,用于检查是否通讯正常.",
- "Webhooks:010001": "载荷地址 {WebhookUri} 已经挂载事件 {Webhooks}!"
+ "Webhooks:010001": "载荷地址 {WebhookUri} 已经挂载事件 {Webhooks}!",
+ "Webhooks:Tests": "测试",
+ "Webhooks:CheckConnect": "检查连接",
+ "Webhooks:CheckConnectDesc": "第三方服务接入时,用于检查是否通讯正常."
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksDefinitionProvider.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksDefinitionProvider.cs
index 9b5e7ce48..0389c1573 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksDefinitionProvider.cs
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksDefinitionProvider.cs
@@ -8,11 +8,15 @@ public class WebhooksDefinitionProvider : WebhookDefinitionProvider
{
public override void Define(IWebhookDefinitionContext context)
{
- context.Add(
+ var testsGroup = context.AddGroup(
+ WebhooksNames.GroupName,
+ L("Webhooks:Tests"));
+
+ testsGroup.AddWebhooks(
new WebhookDefinition(
WebhooksNames.CheckConnect,
- L("DisplayName:CheckConnect"),
- L("Description:CheckConnect")));
+ L("Webhooks:CheckConnect"),
+ L("Webhooks:CheckConnectDesc")));
}
private static ILocalizableString L(string name)
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksNames.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksNames.cs
index 2332b9681..f650eec4b 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksNames.cs
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/Webhooks/WebhooksNames.cs
@@ -2,5 +2,7 @@
public static class WebhooksNames
{
- public const string CheckConnect = "abp.webhooks.check_connect";
+ public const string GroupName = "abp.webhooks.tests";
+
+ public const string CheckConnect = GroupName + ".check_connect";
}
diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.HttpApi/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionController.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.HttpApi/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionController.cs
index 5e42551d2..4cabc602e 100644
--- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.HttpApi/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionController.cs
+++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.HttpApi/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionController.cs
@@ -59,7 +59,7 @@ public class WebhookSubscriptionController : WebhooksManagementControllerBase, I
[HttpGet]
[Route("availables")]
- public Task> GetAllAvailableWebhooksAsync()
+ public Task> GetAllAvailableWebhooksAsync()
{
return SubscriptionAppService.GetAllAvailableWebhooksAsync();
}
diff --git a/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/LY.MicroService.WebhooksManagement.HttpApi.Host.csproj b/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/LY.MicroService.WebhooksManagement.HttpApi.Host.csproj
index 79afc282d..78cda36e2 100644
--- a/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/LY.MicroService.WebhooksManagement.HttpApi.Host.csproj
+++ b/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/LY.MicroService.WebhooksManagement.HttpApi.Host.csproj
@@ -58,6 +58,7 @@
+
diff --git a/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.cs b/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.cs
index c6b452fbe..fe0d5379e 100644
--- a/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.cs
+++ b/aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.cs
@@ -8,6 +8,7 @@ using LINGYUN.Abp.Saas.EntityFrameworkCore;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using LINGYUN.Abp.Serilog.Enrichers.UniqueId;
using LINGYUN.Abp.Webhooks.Identity;
+using LINGYUN.Abp.Webhooks.Saas;
using LINGYUN.Abp.WebhooksManagement;
using LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore;
using Microsoft.AspNetCore.Builder;
@@ -40,6 +41,7 @@ namespace LY.MicroService.WebhooksManagement;
typeof(WebhooksManagementHttpApiModule),
typeof(WebhooksManagementEntityFrameworkCoreModule),
typeof(AbpWebhooksIdentityModule),
+ typeof(AbpWebhooksSaasModule),
typeof(AbpEntityFrameworkCoreMySQLModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpEmailingExceptionHandlingModule),