Browse Source

添加bob-storing集成

pull/637/head
cKey 3 years ago
parent
commit
65bc6fe582
  1. 18
      aspnet-core/LINGYUN.MicroService.Workflow.sln
  2. 2
      aspnet-core/modules/authorization/LINGYUN.Abp.Identity.OrganizaztionUnits/LINGYUN/Abp/Identity/OrganizaztionUnits/OrganizationUnitClaimsPrincipalContributor.cs
  3. 17
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSender.cs
  4. 3
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/FodyWeavers.xml
  5. 30
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/FodyWeavers.xsd
  6. 21
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN.Abp.Elsa.Activities.BlobStoring.csproj
  7. 11
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/AbpElsaActivitiesBlobStoringModule.cs
  8. 8
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/AbpElsaBlobContainer.cs
  9. 36
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/BlobExists.cs
  10. 33
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/DeleteBlob.cs
  11. 36
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/ReadBlob.cs
  12. 40
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/WriteBlob.cs
  13. 16
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Startup.cs
  14. 18
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/Microsoft/Extensions/DependencyInjection/BlobStoringServiceCollectionExtensions.cs
  15. 2
      aspnet-core/modules/permissions-management/LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits/LINGYUN/Abp/PermissionManagement/OrganizationUnits/OrganizationUnitPermissionManagementProvider.cs
  16. 10
      aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/EventBus/Distributed/NotificationEventHandler.cs
  17. 6
      aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/LY.MicroService.WorkflowManagement.HttpApi.Host.csproj
  18. 34
      aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/Pages/_Host.cshtml
  19. 2
      aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/Pages/_ViewImports.cshtml
  20. 93
      aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.Configure.cs
  21. 15
      aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs
  22. 45
      aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/appsettings.Development.json
  23. 3
      aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/appsettings.json

18
aspnet-core/LINGYUN.MicroService.Workflow.sln

@ -51,11 +51,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflow-core", "workflow-c
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "elsa", "elsa", "{F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "elsa", "elsa", "{F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Elsa", "modules\elsa\LINGYUN.Abp.Elsa\LINGYUN.Abp.Elsa.csproj", "{17EA5194-BBE8-4CE1-B6F9-DF6829622F38}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Elsa", "modules\elsa\LINGYUN.Abp.Elsa\LINGYUN.Abp.Elsa.csproj", "{17EA5194-BBE8-4CE1-B6F9-DF6829622F38}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Elsa.Server", "modules\elsa\LINGYUN.Abp.Elsa.Server\LINGYUN.Abp.Elsa.Server.csproj", "{88AA0D46-597E-4969-8382-A3F8054B9409}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Elsa.Server", "modules\elsa\LINGYUN.Abp.Elsa.Server\LINGYUN.Abp.Elsa.Server.csproj", "{88AA0D46-597E-4969-8382-A3F8054B9409}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Elsa.EntityFramework.Core", "modules\elsa\LINGYUN.Abp.Elsa.EntityFramework.Core\LINGYUN.Abp.Elsa.EntityFramework.Core.csproj", "{CAC0D3A2-8BFA-4A84-A7FA-550A3BB16288}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Elsa.EntityFramework.Core", "modules\elsa\LINGYUN.Abp.Elsa.EntityFramework.Core\LINGYUN.Abp.Elsa.EntityFramework.Core.csproj", "{CAC0D3A2-8BFA-4A84-A7FA-550A3BB16288}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Elsa.Activities.BlobStoring", "modules\elsa\LINGYUN.Abp.Elsa.Activities.BlobStoring\LINGYUN.Abp.Elsa.Activities.BlobStoring.csproj", "{81CB5141-4FC5-413A-A516-CD65F40465C0}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -143,6 +145,14 @@ Global
{CAC0D3A2-8BFA-4A84-A7FA-550A3BB16288}.Debug|Any CPU.Build.0 = Debug|Any CPU {CAC0D3A2-8BFA-4A84-A7FA-550A3BB16288}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CAC0D3A2-8BFA-4A84-A7FA-550A3BB16288}.Release|Any CPU.ActiveCfg = Release|Any CPU {CAC0D3A2-8BFA-4A84-A7FA-550A3BB16288}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CAC0D3A2-8BFA-4A84-A7FA-550A3BB16288}.Release|Any CPU.Build.0 = Release|Any CPU {CAC0D3A2-8BFA-4A84-A7FA-550A3BB16288}.Release|Any CPU.Build.0 = Release|Any CPU
{81CB5141-4FC5-413A-A516-CD65F40465C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{81CB5141-4FC5-413A-A516-CD65F40465C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{81CB5141-4FC5-413A-A516-CD65F40465C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{81CB5141-4FC5-413A-A516-CD65F40465C0}.Release|Any CPU.Build.0 = Release|Any CPU
{00CB6328-83F0-4C50-9561-2C61AFC03CA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00CB6328-83F0-4C50-9561-2C61AFC03CA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00CB6328-83F0-4C50-9561-2C61AFC03CA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00CB6328-83F0-4C50-9561-2C61AFC03CA1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -171,6 +181,8 @@ Global
{17EA5194-BBE8-4CE1-B6F9-DF6829622F38} = {F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC} {17EA5194-BBE8-4CE1-B6F9-DF6829622F38} = {F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC}
{88AA0D46-597E-4969-8382-A3F8054B9409} = {F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC} {88AA0D46-597E-4969-8382-A3F8054B9409} = {F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC}
{CAC0D3A2-8BFA-4A84-A7FA-550A3BB16288} = {F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC} {CAC0D3A2-8BFA-4A84-A7FA-550A3BB16288} = {F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC}
{81CB5141-4FC5-413A-A516-CD65F40465C0} = {F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC}
{00CB6328-83F0-4C50-9561-2C61AFC03CA1} = {2F51B296-58EB-4D54-9921-5A07E6E4B7BF}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6BB7A5DE-DA12-44DC-BC9B-0F6CA524346F} SolutionGuid = {6BB7A5DE-DA12-44DC-BC9B-0F6CA524346F}

2
aspnet-core/modules/authorization/LINGYUN.Abp.Identity.OrganizaztionUnits/LINGYUN/Abp/Identity/OrganizaztionUnits/OrganizationUnitClaimsPrincipalContributor.cs

@ -34,7 +34,7 @@ public class OrganizationUnitClaimsPrincipalContributor : IAbpClaimsPrincipalCon
return; return;
} }
var userOus = await _identityUserRepository.GetOrganizationUnitsAsync(userId.Value); var userOus = await _identityUserRepository.GetOrganizationUnitsAsync(id: userId.Value);
foreach (var userOu in userOus) foreach (var userOu in userOus)
{ {

17
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSender.cs

@ -8,6 +8,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus.Distributed; using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Timing;
using Volo.Abp.Uow; using Volo.Abp.Uow;
namespace LINGYUN.Abp.Notifications namespace LINGYUN.Abp.Notifications
@ -18,6 +19,10 @@ namespace LINGYUN.Abp.Notifications
/// </summary> /// </summary>
public class NotificationSender : INotificationSender, ITransientDependency public class NotificationSender : INotificationSender, ITransientDependency
{ {
/// <summary>
/// Reference to <see cref="IClock"/>.
/// </summary>
protected IClock Clock { get; }
/// <summary> /// <summary>
/// Reference to <see cref="ILogger<NotificationSender>"/>. /// Reference to <see cref="ILogger<NotificationSender>"/>.
/// </summary> /// </summary>
@ -37,11 +42,13 @@ namespace LINGYUN.Abp.Notifications
protected AbpNotificationOptions Options { get; } protected AbpNotificationOptions Options { get; }
public NotificationSender( public NotificationSender(
IDistributedEventBus distributedEventBus, IClock clock,
IDistributedIdGenerator distributedIdGenerator, IDistributedEventBus distributedEventBus,
IUnitOfWorkManager unitOfWorkManager, IDistributedIdGenerator distributedIdGenerator,
IOptions<AbpNotificationOptions> options) IUnitOfWorkManager unitOfWorkManager,
IOptions<AbpNotificationOptions> options)
{ {
Clock = clock;
Options = options.Value; Options = options.Value;
DistributedEventBus = distributedEventBus; DistributedEventBus = distributedEventBus;
DistributedIdGenerator = distributedIdGenerator; DistributedIdGenerator = distributedIdGenerator;
@ -82,7 +89,7 @@ namespace LINGYUN.Abp.Notifications
TenantId = tenantId, TenantId = tenantId,
Users = users?.ToList(), Users = users?.ToList(),
Name = name, Name = name,
CreationTime = DateTime.Now, CreationTime = Clock.Now,
Severity = severity Severity = severity
}; };

3
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
</Weavers>

30
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

21
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN.Abp.Elsa.Activities.BlobStoring.csproj

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace />
<Nullable>Enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Elsa.Core" Version="$(ElsaPackageVersion)" />
<PackageReference Include="Volo.Abp.BlobStoring" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.Elsa\LINGYUN.Abp.Elsa.csproj" />
</ItemGroup>
</Project>

11
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/AbpElsaActivitiesBlobStoringModule.cs

@ -0,0 +1,11 @@
using Volo.Abp.BlobStoring;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.Elsa.Activities.BlobStoring;
[DependsOn(
typeof(AbpElsaModule),
typeof(AbpBlobStoringModule))]
public class AbpElsaActivitiesBlobStoringModule : AbpModule
{
}

8
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/AbpElsaBlobContainer.cs

@ -0,0 +1,8 @@
using Volo.Abp.BlobStoring;
namespace LINGYUN.Abp.Elsa.Activities.BlobStoring;
[BlobContainerName("elsa-container")]
public class AbpElsaBlobContainer
{
}

36
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/BlobExists.cs

@ -0,0 +1,36 @@
using Elsa;
using Elsa.ActivityResults;
using Elsa.Attributes;
using Elsa.Services;
using Elsa.Services.Models;
using System;
using System.Threading.Tasks;
using Volo.Abp.BlobStoring;
namespace LINGYUN.Abp.Elsa.Activities.BlobStoring;
[Action(Category = "Blob",
Description = "Check if a blob exists.",
Outcomes = new[] { OutcomeNames.True, OutcomeNames.False })]
public class BlobExists : Activity
{
private readonly IBlobContainer<AbpElsaBlobContainer> _container;
[ActivityInput(Hint = "Path of the oss.")]
public string? Path { get; set; }
public BlobExists(IBlobContainer<AbpElsaBlobContainer> container)
{
_container = container;
}
protected async override ValueTask<IActivityExecutionResult> OnExecuteAsync(ActivityExecutionContext context)
{
var exists = await _container.ExistsAsync(Path, context.CancellationToken);
if (exists)
{
return Outcome(OutcomeNames.True);
}
return Outcome(OutcomeNames.False);
}
}

33
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/DeleteBlob.cs

@ -0,0 +1,33 @@
using Elsa;
using Elsa.ActivityResults;
using Elsa.Attributes;
using Elsa.Services;
using Elsa.Services.Models;
using System;
using System.Threading.Tasks;
using Volo.Abp.BlobStoring;
namespace LINGYUN.Abp.Elsa.Activities.BlobStoring;
[Action(Category = "Blob",
Description = "Deletes blob at specified location",
Outcomes = new[] { OutcomeNames.Done })]
public class DeleteBlob : Activity
{
private readonly IBlobContainer<AbpElsaBlobContainer> _container;
[ActivityInput(Hint = "Path of the blob to be deleted.")]
public string? Path { get; set; }
public DeleteBlob(IBlobContainer<AbpElsaBlobContainer> container)
{
_container = container;
}
protected async override ValueTask<IActivityExecutionResult> OnExecuteAsync(ActivityExecutionContext context)
{
await _container.DeleteAsync(Path, context.CancellationToken);
return Done();
}
}

36
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/ReadBlob.cs

@ -0,0 +1,36 @@
using Elsa;
using Elsa.ActivityResults;
using Elsa.Attributes;
using Elsa.Services;
using Elsa.Services.Models;
using System;
using System.Threading.Tasks;
using Volo.Abp.BlobStoring;
namespace LINGYUN.Abp.Elsa.Activities.BlobStoring;
[Action(Category = "Blob",
Description = "Reads a blob.",
Outcomes = new[] { OutcomeNames.Done })]
public class ReadBlob : Activity
{
private readonly IBlobContainer<AbpElsaBlobContainer> _container;
[ActivityInput(Hint = "Path of the blob.")]
public string? Path { get; set; }
[ActivityOutput]
public byte[]? Output { get; set; }
public ReadBlob(IBlobContainer<AbpElsaBlobContainer> container)
{
_container = container;
}
protected async override ValueTask<IActivityExecutionResult> OnExecuteAsync(ActivityExecutionContext context)
{
Output = await _container.GetAllBytesAsync(Path, context.CancellationToken);
return Done();
}
}

40
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/WriteBlob.cs

@ -0,0 +1,40 @@
using Elsa;
using Elsa.ActivityResults;
using Elsa.Attributes;
using Elsa.Expressions;
using Elsa.Services;
using Elsa.Services.Models;
using System;
using System.Threading.Tasks;
using Volo.Abp.BlobStoring;
namespace LINGYUN.Abp.Elsa.Activities.BlobStoring;
[Action(Category = "Blob",
Description = "Save a blob.",
Outcomes = new[] { OutcomeNames.Done })]
public class WriteBlob : Activity
{
private readonly IBlobContainer<AbpElsaBlobContainer> _container;
[ActivityInput(Hint = "Path of the blob.")]
public string? Path { get; set; }
[ActivityInput(Hint = "Blob exists whether overwrite")]
public bool Overwrite { get; set; }
[ActivityInput(Hint = "The bytes to write.", SupportedSyntaxes = new[] { SyntaxNames.JavaScript }, DefaultSyntax = SyntaxNames.JavaScript)]
public byte[]? Bytes { get; set; }
public WriteBlob(IBlobContainer<AbpElsaBlobContainer> container)
{
_container = container;
}
protected async override ValueTask<IActivityExecutionResult> OnExecuteAsync(ActivityExecutionContext context)
{
await _container.SaveAsync(Path, Bytes, Overwrite, context.CancellationToken);
return Done();
}
}

16
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Startup.cs

@ -0,0 +1,16 @@
using Elsa.Attributes;
using Elsa.Options;
using Elsa.Services.Startup;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace LINGYUN.Abp.Elsa.Activities.BlobStoring;
[Feature("BlobStoring")]
public class Startup : StartupBase
{
public override void ConfigureElsa(ElsaOptionsBuilder elsa, IConfiguration configuration)
{
elsa.AddBlobStoringActivities();
}
}

18
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/Microsoft/Extensions/DependencyInjection/BlobStoringServiceCollectionExtensions.cs

@ -0,0 +1,18 @@
using Elsa.Options;
using LINGYUN.Abp.Elsa.Activities.BlobStoring;
namespace Microsoft.Extensions.DependencyInjection;
public static class BlobStoringServiceCollectionExtensions
{
public static ElsaOptionsBuilder AddBlobStoringActivities(this ElsaOptionsBuilder options)
{
options
.AddActivity<WriteBlob>()
.AddActivity<ReadBlob>()
.AddActivity<BlobExists>()
.AddActivity<DeleteBlob>();
return options;
}
}

2
aspnet-core/modules/permissions-management/LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits/LINGYUN/Abp/PermissionManagement/OrganizationUnits/OrganizationUnitPermissionManagementProvider.cs

@ -68,7 +68,7 @@ public class OrganizationUnitPermissionManagementProvider : PermissionManagement
if (providerName == UserPermissionValueProvider.ProviderName) if (providerName == UserPermissionValueProvider.ProviderName)
{ {
var userId = Guid.Parse(providerKey); var userId = Guid.Parse(providerKey);
var organizationUnits = await IdentityUserRepository.GetOrganizationUnitsAsync(userId); var organizationUnits = await IdentityUserRepository.GetOrganizationUnitsAsync(id: userId);
foreach (var organizationUnit in organizationUnits) foreach (var organizationUnit in organizationUnits)
{ {

10
aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/EventBus/Distributed/NotificationEventHandler.cs

@ -134,11 +134,11 @@ namespace LY.MicroService.RealtimeMessage.EventBus.Distributed
cultureName: eventData.Data.Culture, cultureName: eventData.Data.Culture,
globalContext: new Dictionary<string, object> globalContext: new Dictionary<string, object>
{ {
{ "notification", notification.Name }, { "$notification", notification.Name },
{ "formUser", eventData.Data.FormUser }, { "$formUser", eventData.Data.FormUser },
{ "notificationId", eventData.Id }, { "$notificationId", eventData.Id },
{ "title", title.ToString() }, { "$title", title.ToString() },
{ "creationTime", eventData.CreationTime.ToString("yyyy-MM-dd HH:mm:ss") }, { "$creationTime", eventData.CreationTime.ToString("yyyy-MM-dd HH:mm:ss") },
}); });
var notificationData = new NotificationData(); var notificationData = new NotificationData();

6
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/LY.MicroService.WorkflowManagement.HttpApi.Host.csproj

@ -11,9 +11,10 @@
<PackageReference Include="Elsa.Activities.Http" Version="$(ElsaPackageVersion)" /> <PackageReference Include="Elsa.Activities.Http" Version="$(ElsaPackageVersion)" />
<PackageReference Include="Elsa.Activities.UserTask" Version="$(ElsaPackageVersion)" /> <PackageReference Include="Elsa.Activities.UserTask" Version="$(ElsaPackageVersion)" />
<PackageReference Include="Elsa.Activities.Temporal.Quartz" Version="$(ElsaPackageVersion)" /> <PackageReference Include="Elsa.Activities.Temporal.Quartz" Version="$(ElsaPackageVersion)" />
<!--<PackageReference Include="Elsa.Persistence.EntityFramework.MySql" Version="$(ElsaPackageVersion)" /> <PackageReference Include="Elsa.Persistence.EntityFramework.MySql" Version="$(ElsaPackageVersion)" />
<PackageReference Include="Elsa.Rebus.RabbitMq" Version="$(ElsaPackageVersion)" />
<PackageReference Include="Elsa.Webhooks.Persistence.EntityFramework.MySql" Version="$(ElsaPackageVersion)" /> <PackageReference Include="Elsa.Webhooks.Persistence.EntityFramework.MySql" Version="$(ElsaPackageVersion)" />
<PackageReference Include="Elsa.WorkflowSettings.Persistence.EntityFramework.MySql" Version="$(ElsaPackageVersion)" />--> <PackageReference Include="Elsa.WorkflowSettings.Persistence.EntityFramework.MySql" Version="$(ElsaPackageVersion)" />
<PackageReference Include="Elsa.Designer.Components.Web" Version="$(ElsaPackageVersion)" /> <PackageReference Include="Elsa.Designer.Components.Web" Version="$(ElsaPackageVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(MicrosoftPackageVersion)"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(MicrosoftPackageVersion)">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
@ -45,6 +46,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" /> <ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" />
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" /> <ProjectReference Include="..\..\modules\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Activities.BlobStoring\LINGYUN.Abp.Elsa.Activities.BlobStoring.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Server\LINGYUN.Abp.Elsa.Server.csproj" /> <ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Server\LINGYUN.Abp.Elsa.Server.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa\LINGYUN.Abp.Elsa.csproj" /> <ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa\LINGYUN.Abp.Elsa.csproj" />
<ProjectReference Include="..\..\modules\saas\LINGYUN.Abp.Saas.EntityFrameworkCore\LINGYUN.Abp.Saas.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\modules\saas\LINGYUN.Abp.Saas.EntityFrameworkCore\LINGYUN.Abp.Saas.EntityFrameworkCore.csproj" />

34
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/Pages/_Host.cshtml

@ -1,6 +1,8 @@
@page "/" @page "/"
@inject IConfiguration Configuration;
@{ @{
var serverUrl = $"{Request.Scheme}://{Request.Host}"; var serverUrl = Configuration["Elsa:Server:BaseAddress"];
var basePath = Configuration["Hosting:BasePath"];
} }
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -8,16 +10,32 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Elsa Workflows</title> <title>Elsa Workflows</title>
<link rel="icon" type="image/png" sizes="32x32" href="/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/assets/images/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="@basePath/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/assets/images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/assets/images/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="@basePath/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/assets/images/favicon-16x16.png">
<link rel="stylesheet" href="/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/assets/fonts/inter/inter.css"> <link rel="stylesheet" href="@basePath/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/assets/fonts/inter/inter.css">
<link rel="stylesheet" href="/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/elsa-workflows-studio.css"> <link rel="stylesheet" href="@basePath/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/elsa-workflows-studio.css">
<script src="/_content/Elsa.Designer.Components.Web/monaco-editor/min/vs/loader.js"></script> <script src="@basePath/_content/Elsa.Designer.Components.Web/monaco-editor/min/vs/loader.js"></script>
<script type="module" src="/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/elsa-workflows-studio.esm.js"></script> <script type="module" src="@basePath/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/elsa-workflows-studio.esm.js"></script>
</head> </head>
<body> <body>
<elsa-studio-root server-url="@serverUrl" monaco-lib-path="_content/Elsa.Designer.Components.Web/monaco-editor/min"> <elsa-studio-root server-url="@serverUrl" base-path="@basePath" monaco-lib-path="@basePath.TrimStart('/')/_content/Elsa.Designer.Components.Web/monaco-editor/min">
<elsa-studio-dashboard></elsa-studio-dashboard> <elsa-studio-dashboard></elsa-studio-dashboard>
</elsa-studio-root> </elsa-studio-root>
</body> </body>
<script type="module">
// Import publicly exposed services.
import { WebhooksPlugin } from "@basePath/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/index.esm.js";
// Get a handle to the elsa-studio-root element.
const elsaStudioRoot = document.querySelector('elsa-studio-root');
// Configure Elsa during the 'initializing' event.
elsaStudioRoot.addEventListener('initializing', e => {
const elsa = e.detail;
elsa.pluginManager.registerPlugin(WebhooksPlugin);
});
</script>
</html> </html>

2
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/Pages/_ViewImports.cshtml

@ -0,0 +1,2 @@
@using Microsoft.Extensions.Configuration
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

93
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.Configure.cs

@ -1,6 +1,6 @@
using Elsa; using Elsa;
using Elsa.Activities.UserTask.Extensions;
using Elsa.Options; using Elsa.Options;
using Elsa.Rebus.RabbitMq;
using LINGYUN.Abp.BlobStoring.OssManagement; using LINGYUN.Abp.BlobStoring.OssManagement;
using LINGYUN.Abp.ExceptionHandling; using LINGYUN.Abp.ExceptionHandling;
using LINGYUN.Abp.ExceptionHandling.Emailing; using LINGYUN.Abp.ExceptionHandling.Emailing;
@ -10,6 +10,7 @@ using Medallion.Threading;
using Medallion.Threading.Redis; using Medallion.Threading.Redis;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@ -19,9 +20,11 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using StackExchange.Redis; using StackExchange.Redis;
using System; using System;
using System.Linq;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using System.Text.Unicode; using System.Text.Unicode;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc.AntiForgery;
using Volo.Abp.Auditing; using Volo.Abp.Auditing;
using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring;
using Volo.Abp.Caching; using Volo.Abp.Caching;
@ -38,6 +41,8 @@ namespace LY.MicroService.WorkflowManagement;
public partial class WorkflowManagementHttpApiHostModule public partial class WorkflowManagementHttpApiHostModule
{ {
private const string DefaultCorsPolicyName = "Default";
private const string ApplicationName = "WorkflowManagement";
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
private void PreConfigureFeature() private void PreConfigureFeature()
@ -50,37 +55,46 @@ public partial class WorkflowManagementHttpApiHostModule
private void PreConfigureApp() private void PreConfigureApp()
{ {
AbpSerilogEnrichersConsts.ApplicationName = "WorkflowManagement"; AbpSerilogEnrichersConsts.ApplicationName = ApplicationName;
} }
private void PreConfigureElsa(IServiceCollection services, IConfiguration configuration) private void PreConfigureElsa(IServiceCollection services, IConfiguration configuration)
{ {
var elsaSection = configuration.GetSection("Elsa"); var elsaSection = configuration.GetSection("Elsa");
var startups = new[]
{
typeof(Elsa.Activities.Console.Startup),
typeof(Elsa.Activities.Http.Startup),
typeof(Elsa.Activities.UserTask.Startup),
typeof(Elsa.Activities.Temporal.Quartz.Startup),
typeof(Elsa.Activities.Email.Startup),
typeof(Elsa.Persistence.EntityFramework.MySql.Startup),
typeof(Elsa.Scripting.JavaScript.Startup),
typeof(Elsa.Activities.Webhooks.Startup),
typeof(Elsa.Webhooks.Persistence.EntityFramework.MySql.Startup),
typeof(Elsa.WorkflowSettings.Persistence.EntityFramework.MySql.Startup),
typeof(LINGYUN.Abp.Elsa.Activities.BlobStoring.Startup),
};
PreConfigure<ElsaOptionsBuilder>(builder => PreConfigure<ElsaOptionsBuilder>(elsa =>
{ {
// TODO: 取消注释持久化 elsa
//var connectionString = configuration.GetConnectionString("Workflow"); .AddActivitiesFrom<WorkflowManagementHttpApiHostModule>()
//builder.UseEntityFrameworkPersistence(ef => .AddWorkflowsFrom<WorkflowManagementHttpApiHostModule>()
// ef.UseMySql(connectionString)); .AddFeatures(startups, configuration)
builder.AddQuartzTemporalActivities() .ConfigureWorkflowChannels(options => elsaSection.GetSection("WorkflowChannels").Bind(options))
.AddEmailActivities() .UseRabbitMq(elsaSection["Rebus:RabbitMQ:Connection"]);
.AddUserTaskActivities()
.AddHttpActivities(elsaSection.GetSection("Server").Bind) elsa.DistributedLockingOptionsBuilder
.AddWorkflowsFrom<WorkflowManagementHttpApiHostModule>(); .UseProviderFactory(sp => name =>
//.AddWorkflowSettings() {
//.AddWebhooks(options => var provider = sp.GetRequiredService<IDistributedLockProvider>();
//{
// options.UseEntityFrameworkPersistence(db => return provider.CreateLock(name);
// { });
// db.UseMySql(configuration.GetConnectionString("Workflow"));
// });
//})
//.UseEntityFrameworkPersistence(db =>
//{
// db.UseMySql(configuration.GetConnectionString("Workflow"));
//});
}); });
services.AddNotificationHandlersFrom<WorkflowManagementHttpApiHostModule>();
} }
private void ConfigureEndpoints() private void ConfigureEndpoints()
@ -174,7 +188,7 @@ public partial class WorkflowManagementHttpApiHostModule
{ {
Configure<AbpAuditingOptions>(options => Configure<AbpAuditingOptions>(options =>
{ {
options.ApplicationName = "WorkflowManagement"; options.ApplicationName = ApplicationName;
// 是否启用实体变更记录 // 是否启用实体变更记录
var entitiesChangedConfig = configuration.GetSection("App:TrackingEntitiesChanged"); var entitiesChangedConfig = configuration.GetSection("App:TrackingEntitiesChanged");
if (entitiesChangedConfig.Exists() && entitiesChangedConfig.Get<bool>()) if (entitiesChangedConfig.Exists() && entitiesChangedConfig.Get<bool>())
@ -294,6 +308,12 @@ public partial class WorkflowManagementHttpApiHostModule
private void ConfigureSecurity(IServiceCollection services, IConfiguration configuration, bool isDevelopment = false) private void ConfigureSecurity(IServiceCollection services, IConfiguration configuration, bool isDevelopment = false)
{ {
Configure<AbpAntiForgeryOptions>(options =>
{
options.AutoValidate = false;
//options.AutoValidateFilter = (type) => !type.Namespace.Contains("elsa", StringComparison.CurrentCultureIgnoreCase);
});
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options => .AddJwtBearer(options =>
{ {
@ -316,4 +336,27 @@ public partial class WorkflowManagementHttpApiHostModule
.PersistKeysToStackExchangeRedis(redis, "LINGYUN.Abp.Application:DataProtection:Protection-Keys"); .PersistKeysToStackExchangeRedis(redis, "LINGYUN.Abp.Application:DataProtection:Protection-Keys");
} }
} }
private void ConfigureCors(IServiceCollection services, IConfiguration configuration)
{
services.AddCors(options =>
{
options.AddPolicy(DefaultCorsPolicyName, builder =>
{
builder
.WithOrigins(
configuration["App:CorsOrigins"]
.Split(",", StringSplitOptions.RemoveEmptyEntries)
.Select(o => o.RemovePostFix("/"))
.ToArray()
)
.WithAbpExposedHeaders()
.WithExposedHeaders("_AbpWrapResult", "_AbpDontWrapResult")
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
}
} }

15
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs

@ -27,6 +27,8 @@ using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.Swashbuckle; using Volo.Abp.Swashbuckle;
using LINGYUN.Abp.Elsa.Activities.BlobStoring;
using Elsa;
namespace LY.MicroService.WorkflowManagement; namespace LY.MicroService.WorkflowManagement;
@ -38,14 +40,7 @@ namespace LY.MicroService.WorkflowManagement;
typeof(AbpBlobStoringOssManagementModule), typeof(AbpBlobStoringOssManagementModule),
typeof(AbpElsaModule), typeof(AbpElsaModule),
typeof(AbpElsaServerModule), typeof(AbpElsaServerModule),
//typeof(WorkflowManagementApplicationModule), typeof(AbpElsaActivitiesBlobStoringModule),
//typeof(WorkflowManagementHttpApiModule),
//typeof(WorkflowManagementEntityFrameworkCoreModule),
//typeof(AbpWorkflowCoreComponentsModule),
//typeof(AbpWorkflowCoreDistributedLockModule),
//typeof(AbpWorkflowCoreLifeCycleEventModule),
//typeof(AbpWorkflowCoreRabbitMQModule),
//typeof(AbpWorkflowCorePersistenceEntityFrameworkCoreModule),
typeof(AbpEntityFrameworkCoreMySQLModule), typeof(AbpEntityFrameworkCoreMySQLModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpEmailingExceptionHandlingModule), typeof(AbpEmailingExceptionHandlingModule),
@ -90,6 +85,7 @@ public partial class WorkflowManagementHttpApiHostModule : AbpModule
ConfigureAuditing(configuration); ConfigureAuditing(configuration);
ConfigureMultiTenancy(configuration); ConfigureMultiTenancy(configuration);
ConfigureSwagger(context.Services); ConfigureSwagger(context.Services);
ConfigureCors(context.Services, configuration);
ConfigureBlobStoring(context.Services, configuration); ConfigureBlobStoring(context.Services, configuration);
ConfigureDistributedLock(context.Services, configuration); ConfigureDistributedLock(context.Services, configuration);
ConfigureSeedWorker(context.Services, hostingEnvironment.IsDevelopment()); ConfigureSeedWorker(context.Services, hostingEnvironment.IsDevelopment());
@ -107,7 +103,8 @@ public partial class WorkflowManagementHttpApiHostModule : AbpModule
app.UseHttpActivities(); app.UseHttpActivities();
app.UseCorrelationId(); app.UseCorrelationId();
app.UseRouting(); app.UseRouting();
app.UseCors(); app.UseCors(DefaultCorsPolicyName);
app.UseElsaFeatures();
app.UseAuthentication(); app.UseAuthentication();
app.UseJwtTokenMiddleware(); app.UseJwtTokenMiddleware();
app.UseMultiTenancy(); app.UseMultiTenancy();

45
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/appsettings.Development.json

@ -8,7 +8,8 @@
"tag": "LINGYUN.Abp.WorkflowManagement" "tag": "LINGYUN.Abp.WorkflowManagement"
}, },
"App": { "App": {
"TrackingEntitiesChanged": true "TrackingEntitiesChanged": true,
"CorsOrigins": "http://127.0.0.1:3100"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=Workflow;User Id=root;Password=123456", "Default": "Server=127.0.0.1;Database=Workflow;User Id=root;Password=123456",
@ -22,6 +23,48 @@
"AbpSaas": "Server=127.0.0.1;Database=Platform;User Id=root;Password=123456" "AbpSaas": "Server=127.0.0.1;Database=Platform;User Id=root;Password=123456"
}, },
"Elsa": { "Elsa": {
"Features": {
"DefaultPersistence": {
"ConnectionStringIdentifier": "Workflow",
"EntityFrameworkCore": {
"MySql": {
"Enabled": true
}
}
},
"Console": true,
"Http": true,
"Email": true,
"TemporalQuartz": true,
"JavaScriptActivities": true,
"UserTask": true,
"Conductor": true,
"Telnyx": true,
"BlobStoring": true,
"Webhooks": {
"Enabled": true,
"ConnectionStringIdentifier": "Workflow",
"EntityFrameworkCore": {
"MySql": {
"Enabled": true
}
}
},
"WorkflowSettings": {
"Enabled": true,
"ConnectionStringIdentifier": "Workflow",
"EntityFrameworkCore": {
"MySql": {
"Enabled": true
}
}
}
},
"Rebus": {
"RabbitMQ": {
"Connection": "amqp://admin:662874@127.0.0.1:5672/"
}
},
"Server": { "Server": {
"BaseUrl": "http://localhost:5001" "BaseUrl": "http://localhost:5001"
} }

3
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/appsettings.json

@ -5,6 +5,9 @@
"DefaultSalt": "sf&5)s3#" "DefaultSalt": "sf&5)s3#"
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"Hosting": {
"BasePath": ""
},
"Serilog": { "Serilog": {
"MinimumLevel": { "MinimumLevel": {
"Default": "Debug", "Default": "Debug",

Loading…
Cancel
Save