27 changed files with 559 additions and 10 deletions
@ -0,0 +1,3 @@ |
|||||
|
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
||||
|
<ConfigureAwait ContinueOnCapturedContext="false" /> |
||||
|
</Weavers> |
||||
@ -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> |
||||
@ -0,0 +1,29 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\..\configureawait.props" /> |
||||
|
<Import Project="..\..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>net6.0</TargetFramework> |
||||
|
<RootNamespace /> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<None Remove="LINGYUN\Abp\PushPlus\SettingManagement\Localization\Resources\*.json" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<EmbeddedResource Include="LINGYUN\Abp\PushPlus\SettingManagement\Localization\Resources\*.json" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="$(VoloAbpPackageVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.SettingManagement.Domain" Version="$(VoloAbpPackageVersion)" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\..\settings\LINGYUN.Abp.SettingManagement.Application.Contracts\LINGYUN.Abp.SettingManagement.Application.Contracts.csproj" /> |
||||
|
<ProjectReference Include="..\LINGYUN.Abp.PushPlus\LINGYUN.Abp.PushPlus.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,48 @@ |
|||||
|
using LINGYUN.Abp.PushPlus.Localization; |
||||
|
using Localization.Resources.AbpUi; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
using Volo.Abp.Localization; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.VirtualFileSystem; |
||||
|
|
||||
|
namespace LINGYUN.Abp.PushPlus.SettingManagement |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(AbpPushPlusModule), |
||||
|
typeof(AbpAspNetCoreMvcModule))] |
||||
|
public class AbpPushPlusSettingManagementModule : AbpModule |
||||
|
{ |
||||
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
PreConfigure<IMvcBuilder>(mvcBuilder => |
||||
|
{ |
||||
|
mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpPushPlusSettingManagementModule).Assembly); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpVirtualFileSystemOptions>(options => |
||||
|
{ |
||||
|
options.FileSets.AddEmbedded<AbpPushPlusSettingManagementModule>(); |
||||
|
}); |
||||
|
|
||||
|
Configure<AbpLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.Resources |
||||
|
.Get<PushPlusResource>() |
||||
|
.AddVirtualJson("/LINGYUN/Abp/PushPlus/SettingManagement/Localization/Resources"); |
||||
|
}); |
||||
|
|
||||
|
Configure<AbpLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.Resources |
||||
|
.Get<PushPlusResource>() |
||||
|
.AddBaseTypes( |
||||
|
typeof(AbpUiResource) |
||||
|
); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
using LINGYUN.Abp.SettingManagement; |
||||
|
|
||||
|
namespace LINGYUN.Abp.PushPlus.SettingManagement |
||||
|
{ |
||||
|
public interface IPushPlusSettingAppService : IReadonlySettingAppService |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
{ |
||||
|
"culture": "en", |
||||
|
"texts": { |
||||
|
"Permission:PushPlus": "PushPlus", |
||||
|
"Permission:ManageSetting": "Manage Setting" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
{ |
||||
|
"culture": "zh-Hans", |
||||
|
"texts": { |
||||
|
"Permission:PushPlus": "PushPlus", |
||||
|
"Permission:ManageSetting": "管理设置" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,67 @@ |
|||||
|
using LINGYUN.Abp.SettingManagement; |
||||
|
using LINGYUN.Abp.PushPlus.Localization; |
||||
|
using LINGYUN.Abp.PushPlus.Settings; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
using Volo.Abp.SettingManagement; |
||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
|
namespace LINGYUN.Abp.PushPlus.SettingManagement |
||||
|
{ |
||||
|
public class WxPusherSettingAppService : ApplicationService, IPushPlusSettingAppService |
||||
|
{ |
||||
|
protected ISettingManager SettingManager { get; } |
||||
|
protected IPermissionChecker PermissionChecker { get; } |
||||
|
protected ISettingDefinitionManager SettingDefinitionManager { get; } |
||||
|
|
||||
|
public WxPusherSettingAppService( |
||||
|
ISettingManager settingManager, |
||||
|
IPermissionChecker permissionChecker, |
||||
|
ISettingDefinitionManager settingDefinitionManager) |
||||
|
{ |
||||
|
SettingManager = settingManager; |
||||
|
PermissionChecker = permissionChecker; |
||||
|
SettingDefinitionManager = settingDefinitionManager; |
||||
|
LocalizationResource = typeof(PushPlusResource); |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<SettingGroupResult> GetAllForCurrentTenantAsync() |
||||
|
{ |
||||
|
return await GetAllForProviderAsync(TenantSettingValueProvider.ProviderName, CurrentTenant.GetId().ToString()); |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<SettingGroupResult> GetAllForGlobalAsync() |
||||
|
{ |
||||
|
return await GetAllForProviderAsync(GlobalSettingValueProvider.ProviderName, null); |
||||
|
} |
||||
|
|
||||
|
protected async virtual Task<SettingGroupResult> GetAllForProviderAsync(string providerName, string providerKey) |
||||
|
{ |
||||
|
var settingGroups = new SettingGroupResult(); |
||||
|
var pushPlusSettingGroup = new SettingGroupDto(L["DisplayName:PushPlus"], L["Description:PushPlus"]); |
||||
|
|
||||
|
if (await PermissionChecker.IsGrantedAsync(PushPlusSettingPermissionNames.ManageSetting)) |
||||
|
{ |
||||
|
var securitySetting = pushPlusSettingGroup.AddSetting(L["Security"], L["Security"]); |
||||
|
securitySetting.AddDetail( |
||||
|
SettingDefinitionManager.Get(PushPlusSettingNames.Security.Token), |
||||
|
StringLocalizerFactory, |
||||
|
await SettingManager.GetOrNullAsync(PushPlusSettingNames.Security.Token, providerName, providerKey), |
||||
|
ValueType.String, |
||||
|
providerName); |
||||
|
securitySetting.AddDetail( |
||||
|
SettingDefinitionManager.Get(PushPlusSettingNames.Security.SecretKey), |
||||
|
StringLocalizerFactory, |
||||
|
await SettingManager.GetOrNullAsync(PushPlusSettingNames.Security.SecretKey, providerName, providerKey), |
||||
|
ValueType.String, |
||||
|
providerName); |
||||
|
} |
||||
|
|
||||
|
settingGroups.AddGroup(pushPlusSettingGroup); |
||||
|
|
||||
|
return settingGroups; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
using LINGYUN.Abp.SettingManagement; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
|
||||
|
namespace LINGYUN.Abp.PushPlus.SettingManagement |
||||
|
{ |
||||
|
[RemoteService(Name = AbpSettingManagementRemoteServiceConsts.RemoteServiceName)] |
||||
|
[Area(AbpSettingManagementRemoteServiceConsts.ModuleName)] |
||||
|
[Route($"api/{AbpSettingManagementRemoteServiceConsts.ModuleName}/push-plus")] |
||||
|
public class WxPusherSettingController : AbpController, IPushPlusSettingAppService |
||||
|
{ |
||||
|
protected IPushPlusSettingAppService Service { get; } |
||||
|
|
||||
|
public WxPusherSettingController( |
||||
|
IPushPlusSettingAppService service) |
||||
|
{ |
||||
|
Service = service; |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("by-current-tenant")] |
||||
|
public async virtual Task<SettingGroupResult> GetAllForCurrentTenantAsync() |
||||
|
{ |
||||
|
return await Service.GetAllForCurrentTenantAsync(); |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("by-global")] |
||||
|
public async virtual Task<SettingGroupResult> GetAllForGlobalAsync() |
||||
|
{ |
||||
|
return await Service.GetAllForGlobalAsync(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
using LINGYUN.Abp.PushPlus.Localization; |
||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Volo.Abp.Localization; |
||||
|
|
||||
|
namespace LINGYUN.Abp.PushPlus.SettingManagement |
||||
|
{ |
||||
|
public class PushPlusSettingPermissionDefinitionProvider : PermissionDefinitionProvider |
||||
|
{ |
||||
|
public override void Define(IPermissionDefinitionContext context) |
||||
|
{ |
||||
|
var pushPlusGroup = context.AddGroup( |
||||
|
PushPlusSettingPermissionNames.GroupName, |
||||
|
L("Permission:PushPlus")); |
||||
|
|
||||
|
pushPlusGroup.AddPermission( |
||||
|
PushPlusSettingPermissionNames.ManageSetting, L("Permission:ManageSetting")); |
||||
|
} |
||||
|
|
||||
|
private static LocalizableString L(string name) |
||||
|
{ |
||||
|
return LocalizableString.Create<PushPlusResource>(name); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
namespace LINGYUN.Abp.PushPlus.SettingManagement |
||||
|
{ |
||||
|
public class PushPlusSettingPermissionNames |
||||
|
{ |
||||
|
public const string GroupName = "Abp.PushPlus"; |
||||
|
|
||||
|
public const string ManageSetting = GroupName + ".ManageSetting"; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,3 @@ |
|||||
|
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
||||
|
<ConfigureAwait ContinueOnCapturedContext="false" /> |
||||
|
</Weavers> |
||||
@ -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> |
||||
@ -0,0 +1,29 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\..\configureawait.props" /> |
||||
|
<Import Project="..\..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>net6.0</TargetFramework> |
||||
|
<RootNamespace /> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<None Remove="LINGYUN\Abp\WxPusher\SettingManagement\Localization\Resources\*.json" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<EmbeddedResource Include="LINGYUN\Abp\WxPusher\SettingManagement\Localization\Resources\*.json" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="$(VoloAbpPackageVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.SettingManagement.Domain" Version="$(VoloAbpPackageVersion)" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\..\settings\LINGYUN.Abp.SettingManagement.Application.Contracts\LINGYUN.Abp.SettingManagement.Application.Contracts.csproj" /> |
||||
|
<ProjectReference Include="..\LINGYUN.Abp.WxPusher\LINGYUN.Abp.WxPusher.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,48 @@ |
|||||
|
using LINGYUN.Abp.WxPusher.Localization; |
||||
|
using Localization.Resources.AbpUi; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
using Volo.Abp.Localization; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.VirtualFileSystem; |
||||
|
|
||||
|
namespace LINGYUN.Abp.WxPusher.SettingManagement |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(AbpWxPusherModule), |
||||
|
typeof(AbpAspNetCoreMvcModule))] |
||||
|
public class AbpWxPusherSettingManagementModule : AbpModule |
||||
|
{ |
||||
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
PreConfigure<IMvcBuilder>(mvcBuilder => |
||||
|
{ |
||||
|
mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpWxPusherSettingManagementModule).Assembly); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpVirtualFileSystemOptions>(options => |
||||
|
{ |
||||
|
options.FileSets.AddEmbedded<AbpWxPusherSettingManagementModule>(); |
||||
|
}); |
||||
|
|
||||
|
Configure<AbpLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.Resources |
||||
|
.Get<WxPusherResource>() |
||||
|
.AddVirtualJson("/LINGYUN/Abp/WxPusher/SettingManagement/Localization/Resources"); |
||||
|
}); |
||||
|
|
||||
|
Configure<AbpLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.Resources |
||||
|
.Get<WxPusherResource>() |
||||
|
.AddBaseTypes( |
||||
|
typeof(AbpUiResource) |
||||
|
); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
using LINGYUN.Abp.SettingManagement; |
||||
|
|
||||
|
namespace LINGYUN.Abp.WxPusher.SettingManagement |
||||
|
{ |
||||
|
public interface IWxPusherSettingAppService : IReadonlySettingAppService |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
{ |
||||
|
"culture": "en", |
||||
|
"texts": { |
||||
|
"Permission:WxPusher": "WxPusher", |
||||
|
"Permission:ManageSetting": "Manage Setting" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
{ |
||||
|
"culture": "zh-Hans", |
||||
|
"texts": { |
||||
|
"Permission:WxPusher": "WxPusher", |
||||
|
"Permission:ManageSetting": "管理设置" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
using LINGYUN.Abp.SettingManagement; |
||||
|
using LINGYUN.Abp.WxPusher.Localization; |
||||
|
using LINGYUN.Abp.WxPusher.Settings; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
using Volo.Abp.SettingManagement; |
||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
|
namespace LINGYUN.Abp.WxPusher.SettingManagement |
||||
|
{ |
||||
|
public class WxPusherSettingAppService : ApplicationService, IWxPusherSettingAppService |
||||
|
{ |
||||
|
protected ISettingManager SettingManager { get; } |
||||
|
protected IPermissionChecker PermissionChecker { get; } |
||||
|
protected ISettingDefinitionManager SettingDefinitionManager { get; } |
||||
|
|
||||
|
public WxPusherSettingAppService( |
||||
|
ISettingManager settingManager, |
||||
|
IPermissionChecker permissionChecker, |
||||
|
ISettingDefinitionManager settingDefinitionManager) |
||||
|
{ |
||||
|
SettingManager = settingManager; |
||||
|
PermissionChecker = permissionChecker; |
||||
|
SettingDefinitionManager = settingDefinitionManager; |
||||
|
LocalizationResource = typeof(WxPusherResource); |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<SettingGroupResult> GetAllForCurrentTenantAsync() |
||||
|
{ |
||||
|
return await GetAllForProviderAsync(TenantSettingValueProvider.ProviderName, CurrentTenant.GetId().ToString()); |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<SettingGroupResult> GetAllForGlobalAsync() |
||||
|
{ |
||||
|
return await GetAllForProviderAsync(GlobalSettingValueProvider.ProviderName, null); |
||||
|
} |
||||
|
|
||||
|
protected async virtual Task<SettingGroupResult> GetAllForProviderAsync(string providerName, string providerKey) |
||||
|
{ |
||||
|
var settingGroups = new SettingGroupResult(); |
||||
|
var wxPusherSettingGroup = new SettingGroupDto(L["DisplayName:WxPusher"], L["Description:WxPusher"]); |
||||
|
|
||||
|
if (await PermissionChecker.IsGrantedAsync(WxPusherSettingPermissionNames.ManageSetting)) |
||||
|
{ |
||||
|
var securitySetting = wxPusherSettingGroup.AddSetting(L["Security"], L["Security"]); |
||||
|
securitySetting.AddDetail( |
||||
|
SettingDefinitionManager.Get(WxPusherSettingNames.Security.AppToken), |
||||
|
StringLocalizerFactory, |
||||
|
await SettingManager.GetOrNullAsync(WxPusherSettingNames.Security.AppToken, providerName, providerKey), |
||||
|
ValueType.String, |
||||
|
providerName); |
||||
|
} |
||||
|
|
||||
|
settingGroups.AddGroup(wxPusherSettingGroup); |
||||
|
|
||||
|
return settingGroups; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
using LINGYUN.Abp.SettingManagement; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
|
||||
|
namespace LINGYUN.Abp.WxPusher.SettingManagement |
||||
|
{ |
||||
|
[RemoteService(Name = AbpSettingManagementRemoteServiceConsts.RemoteServiceName)] |
||||
|
[Area(AbpSettingManagementRemoteServiceConsts.ModuleName)] |
||||
|
[Route($"api/{AbpSettingManagementRemoteServiceConsts.ModuleName}/wx-pusher")] |
||||
|
public class WxPusherSettingController : AbpController, IWxPusherSettingAppService |
||||
|
{ |
||||
|
protected IWxPusherSettingAppService Service { get; } |
||||
|
|
||||
|
public WxPusherSettingController( |
||||
|
IWxPusherSettingAppService service) |
||||
|
{ |
||||
|
Service = service; |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("by-current-tenant")] |
||||
|
public async virtual Task<SettingGroupResult> GetAllForCurrentTenantAsync() |
||||
|
{ |
||||
|
return await Service.GetAllForCurrentTenantAsync(); |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("by-global")] |
||||
|
public async virtual Task<SettingGroupResult> GetAllForGlobalAsync() |
||||
|
{ |
||||
|
return await Service.GetAllForGlobalAsync(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
using LINGYUN.Abp.WxPusher.Localization; |
||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Volo.Abp.Localization; |
||||
|
|
||||
|
namespace LINGYUN.Abp.WxPusher.SettingManagement |
||||
|
{ |
||||
|
public class WxPusherSettingPermissionDefinitionProvider : PermissionDefinitionProvider |
||||
|
{ |
||||
|
public override void Define(IPermissionDefinitionContext context) |
||||
|
{ |
||||
|
var wxPusherGroup = context.AddGroup( |
||||
|
WxPusherSettingPermissionNames.GroupName, |
||||
|
L("Permission:WxPusher")); |
||||
|
|
||||
|
wxPusherGroup.AddPermission( |
||||
|
WxPusherSettingPermissionNames.ManageSetting, L("Permission:ManageSetting")); |
||||
|
} |
||||
|
|
||||
|
private static LocalizableString L(string name) |
||||
|
{ |
||||
|
return LocalizableString.Create<WxPusherResource>(name); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
namespace LINGYUN.Abp.WxPusher.SettingManagement |
||||
|
{ |
||||
|
public class WxPusherSettingPermissionNames |
||||
|
{ |
||||
|
public const string GroupName = "Abp.WxPusher"; |
||||
|
|
||||
|
public const string ManageSetting = GroupName + ".ManageSetting"; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue