Browse Source

feat: 重命名cap模块,添加cap Dashboard 授权策略

pull/89/head 6.0.1.4
王军 3 years ago
parent
commit
2452d28ed9
  1. 3
      aspnet-core/frameworks/src/Lion.AbpPro.CAP/GlobalUsings.cs
  2. 13
      aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion.AbpPro.CAP.csproj
  3. 6
      aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/AbpProAbpCapModule.cs
  4. 4
      aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/LionAbpProCapConsumerServiceSelector.cs
  5. 4
      aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/LionAbpProCapDistributedEventBus.cs
  6. 8
      aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/LionAbpProCapModule.cs
  7. 19
      aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/LionAbpProCapPermissionDefinitionProvider.cs
  8. 12
      aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/LionAbpProCapPermissions.cs
  9. 6
      aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/LionAbpProCapServiceCollectionExtensions.cs
  10. 3
      aspnet-core/frameworks/src/Lion.AbpPro.Localization/Lion/AbpPro/Localization/Resources/en.json
  11. 3
      aspnet-core/frameworks/src/Lion.AbpPro.Localization/Lion/AbpPro/Localization/Resources/zh-Hans.json
  12. 1
      aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Domain.Shared/Localization/BasicManagement/en.json
  13. 1
      aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Domain.Shared/Localization/BasicManagement/zh-Hans.json
  14. 2
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/NotificationManagementHttpApiHostModule.cs
  15. 6
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs
  16. 1
      aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/en.json
  17. 1
      aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/zh-Hans.json

3
aspnet-core/frameworks/src/Lion.AbpPro.CAP/GlobalUsings.cs

@ -0,0 +1,3 @@
// Global using directives
global using Volo.Abp.Authorization.Permissions;

13
aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion.AbpPro.CAP.csproj

@ -2,13 +2,18 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace/>
<RootNamespace />
<AssemblyName>Lion.AbpPro.CAP</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Core"/>
<PackageReference Include="Volo.Abp.EventBus"/>
<PackageReference Include="DotNetCore.CAP"/>
<PackageReference Include="Volo.Abp.Authorization.Abstractions" />
<PackageReference Include="Volo.Abp.Core" />
<PackageReference Include="Volo.Abp.EventBus" />
<PackageReference Include="DotNetCore.CAP" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lion.AbpPro.Localization\Lion.AbpPro.Localization.csproj" />
</ItemGroup>
</Project>

6
aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/AbpProAbpCapModule.cs

@ -1,6 +0,0 @@
namespace Lion.AbpPro.CAP;
[DependsOn(typeof(AbpEventBusModule))]
public class AbpProAbpCapModule : AbpModule
{
}

4
aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/AbpProAbpCapConsumerServiceSelector.cs → aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/LionAbpProCapConsumerServiceSelector.cs

@ -2,7 +2,7 @@ namespace Lion.AbpPro.CAP;
[Dependency(ServiceLifetime.Singleton, ReplaceServices = true)]
[ExposeServices(typeof(IConsumerServiceSelector))]
public sealed class AbpProAbpCapConsumerServiceSelector : ConsumerServiceSelector
public sealed class LionAbpProCapConsumerServiceSelector : ConsumerServiceSelector
{
private AbpDistributedEventBusOptions AbpDistributedEventBusOptions { get; }
private IServiceProvider ServiceProvider { get; }
@ -10,7 +10,7 @@ public sealed class AbpProAbpCapConsumerServiceSelector : ConsumerServiceSelecto
/// <summary>
/// Creates a new <see cref="T:DotNetCore.CAP.Internal.ConsumerServiceSelector" />.
/// </summary>
public AbpProAbpCapConsumerServiceSelector(
public LionAbpProCapConsumerServiceSelector(
IServiceProvider serviceProvider,
IOptions<AbpDistributedEventBusOptions> distributedEventBusOptions)
: base(serviceProvider)

4
aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/AbpProAbpCapDistributedEventBus.cs → aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/LionAbpProCapDistributedEventBus.cs

@ -1,6 +1,6 @@
namespace Lion.AbpPro.CAP;
public class AbpProAbpCapDistributedEventBus :
public class LionAbpProCapDistributedEventBus :
EventBusBase,
IDistributedEventBus,
ISingletonDependency
@ -12,7 +12,7 @@ public class AbpProAbpCapDistributedEventBus :
private readonly ICapPublisher CapPublisher;
public AbpProAbpCapDistributedEventBus(IServiceScopeFactory serviceScopeFactory,
public LionAbpProCapDistributedEventBus(IServiceScopeFactory serviceScopeFactory,
IOptions<AbpDistributedEventBusOptions> distributedEventBusOptions,
ICapPublisher capPublisher,
ICurrentTenant currentTenant,

8
aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/LionAbpProCapModule.cs

@ -0,0 +1,8 @@
namespace Lion.AbpPro.CAP;
[DependsOn(
typeof(AbpEventBusModule),
typeof(LionAbpProLocalizationModule))]
public class LionAbpProCapModule : AbpModule
{
}

19
aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/LionAbpProCapPermissionDefinitionProvider.cs

@ -0,0 +1,19 @@
using Lion.AbpPro.Localization;
using Volo.Abp.Localization;
namespace Lion.AbpPro.CAP;
public class LionAbpProCapPermissionDefinitionProvider : PermissionDefinitionProvider
{
public override void Define(IPermissionDefinitionContext context)
{
var abpIdentityGroup = context.GetGroup(LionAbpProCapPermissions.CapManagement.Default);
abpIdentityGroup.AddPermission(LionAbpProCapPermissions.CapManagement.Cap, L("Permission:Cap"));
}
private static LocalizableString L(string name)
{
return LocalizableString.Create<LionAbpProLocalizationResource>(name);
}
}

12
aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/LionAbpProCapPermissions.cs

@ -0,0 +1,12 @@
namespace Lion.AbpPro.CAP;
public static class LionAbpProCapPermissions
{
public static class CapManagement
{
public const string Default = "AbpIdentity";
public const string Cap = Default + ".Cap";
}
}

6
aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/AbpProAbpCapServiceCollectionExtensions.cs → aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/LionAbpProCapServiceCollectionExtensions.cs

@ -1,14 +1,14 @@
namespace Lion.AbpPro.CAP;
public static class AbpProAbpCapServiceCollectionExtensions
public static class LionAbpProCapServiceCollectionExtensions
{
public static ServiceConfigurationContext AddAbpCap(
this ServiceConfigurationContext context,
Action<CapOptions> capAction)
{
context.Services.AddCap(capAction);
context.Services.AddSingleton<IConsumerServiceSelector, AbpProAbpCapConsumerServiceSelector>();
context.Services.AddSingleton<IDistributedEventBus, AbpProAbpCapDistributedEventBus>();
context.Services.AddSingleton<IConsumerServiceSelector, LionAbpProCapConsumerServiceSelector>();
context.Services.AddSingleton<IDistributedEventBus, LionAbpProCapDistributedEventBus>();
return context;
}
}

3
aspnet-core/frameworks/src/Lion.AbpPro.Localization/Lion/AbpPro/Localization/Resources/en.json

@ -1,6 +1,7 @@
{
"culture": "en",
"texts": {
"Welcome": "Welcome"
"Welcome": "Welcome",
"Permission:Cap": "CAP Dashboard"
}
}

3
aspnet-core/frameworks/src/Lion.AbpPro.Localization/Lion/AbpPro/Localization/Resources/zh-Hans.json

@ -1,6 +1,7 @@
{
"culture": "zh-Hans",
"texts": {
"Welcome": "欢迎"
"Welcome": "欢迎",
"Permission:Cap": "CAP面板"
}
}

1
aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Domain.Shared/Localization/BasicManagement/en.json

@ -12,7 +12,6 @@
"Permission:SystemManagement": "SystemManagement",
"Permission:AuditLogManagement": "AuditLog",
"Permission:HangfireManagement": "BackgroundTask",
"Permission:CapManagement": "IntegratedEvent",
"Permission:SettingManagement": "SettingManagement",
"Permission:OrganizationUnitManagement": "OrganizationUnitManagement",
"Setting.Group.System": "System",

1
aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Domain.Shared/Localization/BasicManagement/zh-Hans.json

@ -12,7 +12,6 @@
"Permission:AuditLogManagement": "审计日志",
"Permission:SystemManagement": "系统管理",
"Permission:HangfireManagement": "后台任务",
"Permission:CapManagement": "集成事件",
"Permission:SettingManagement": "设置管理",
"Permission:OrganizationUnitManagement": "组织结构管理",

2
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/NotificationManagementHttpApiHostModule.cs

@ -8,7 +8,7 @@ namespace Lion.AbpPro.NotificationManagement;
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpSwashbuckleModule),
typeof(AbpProAbpCapModule),
typeof(LionAbpProCapModule),
typeof(AbpEntityFrameworkCoreMySQLModule)
)]
public class NotificationManagementHttpApiHostModule : AbpModule

6
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs

@ -13,7 +13,7 @@ namespace Lion.AbpPro
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAccountWebModule),
typeof(AbpProApplicationModule),
typeof(AbpProAbpCapModule),
typeof(LionAbpProCapModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpBackgroundJobsHangfireModule)
@ -298,7 +298,9 @@ namespace Lion.AbpPro
var hostingEnvironment = context.Services.GetHostingEnvironment();
bool auth = !hostingEnvironment.IsDevelopment();
capOptions.UseDashboard(options => { options.UseAuth = auth; });
capOptions.UseDashboard(options => { options.UseAuth = auth;
options.AuthorizationPolicy = LionAbpProCapPermissions.CapManagement.Cap;
});
});
}
else

1
aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/en.json

@ -14,7 +14,6 @@
"Permission:SystemManagement": "SystemManagement",
"Permission:AuditLogManagement": "AuditLog",
"Permission:HangfireManagement": "BackgroundTask",
"Permission:CapManagement": "IntegratedEvent",
"Permission:ESManagement": "ESManagement",
"Permission:SettingManagement": "SettingManagement",
"Permission:OrganizationUnitManagement": "OrganizationUnitManagement",

1
aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/zh-Hans.json

@ -14,7 +14,6 @@
"Permission:AuditLogManagement": "审计日志",
"Permission:SystemManagement": "系统管理",
"Permission:HangfireManagement": "后台任务",
"Permission:CapManagement": "集成事件",
"Permission:ESManagement": "ES日志",
"Permission:SettingManagement": "设置管理",
"Permission:OrganizationUnitManagement": "组织结构管理",

Loading…
Cancel
Save