Browse Source

Resolve some problems

** fix(identity): 扩展身份认证无需刷新用户安全令牌

** feat(wechat): 企业微信设置项加入到微信设置管理模块

** fix(realtime): NotificationPublishJobArgs增加空构造函数, 以便反序列化并重新运行失败的通知作业
pull/887/head
colin 2 years ago
parent
commit
9f275dc9c6
  1. 5
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Core/LINGYUN/Abp/Notifications/UserIdentifier.cs
  2. 3
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.SmsValidator/LINGYUN/Abp/IdentityServer/SmsValidator/SmsTokenGrantValidator.cs
  3. 3
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChat.Work/LINGYUN/Abp/IdentityServer/WeChat/Work/WeChatWorkGrantValidator.cs
  4. 2
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.Sms/LINGYUN/Abp/OpenIddict/Sms/SmsTokenExtensionGrant.cs
  5. 3
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat.Work/LINGYUN/Abp/OpenIddict/WeChat/Work/WeChatWorkTokenExtensionGrant.cs
  6. 3
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat/LINGYUN/Abp/OpenIddict/WeChat/WeChatTokenExtensionGrant.cs
  7. 1
      aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN.Abp.WeChat.SettingManagement.csproj
  8. 6
      aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN/Abp/WeChat/SettingManagement/AbpWeChatSettingManagementModule.cs
  9. 3
      aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN/Abp/WeChat/SettingManagement/Localization/Resources/en.json
  10. 3
      aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN/Abp/WeChat/SettingManagement/Localization/Resources/zh-Hans.json
  11. 27
      aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN/Abp/WeChat/SettingManagement/WeChatSettingAppService.cs
  12. 14
      aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN/Abp/WeChat/SettingManagement/WeChatSettingPermissionDefinitionProvider.cs
  13. 1
      aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN/Abp/WeChat/SettingManagement/WeChatSettingPermissionNames.cs
  14. 4
      aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Localization/Resources/en.json
  15. 4
      aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Localization/Resources/zh-Hans.json
  16. 2
      aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Settings/WeChatWorkSettingDefinitionProvider.cs
  17. 4
      aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/BackgroundJobs/NotificationPublishJobArgs.cs

5
aspnet-core/modules/common/LINGYUN.Abp.Notifications.Core/LINGYUN/Abp/Notifications/UserIdentifier.cs

@ -16,6 +16,11 @@ namespace LINGYUN.Abp.Notifications
/// </summary>
public string UserName { get; set; }
public UserIdentifier()
{
}
public UserIdentifier(Guid userId, string userName)
{
UserId = userId;

3
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.SmsValidator/LINGYUN/Abp/IdentityServer/SmsValidator/SmsTokenGrantValidator.cs

@ -114,9 +114,6 @@ namespace LINGYUN.Abp.IdentityServer.SmsValidator
await EventService.RaiseAsync(new UserLoginSuccessEvent(currentUser.UserName, phoneNumber, null));
// 登录之后需要更新安全令牌
(await UserManager.UpdateSecurityStampAsync(currentUser)).CheckErrors();
await SetSuccessResultAsync(context, currentUser);
}

3
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChat.Work/LINGYUN/Abp/IdentityServer/WeChat/Work/WeChatWorkGrantValidator.cs

@ -123,9 +123,6 @@ public class WeChatWorkGrantValidator : IExtensionGrantValidator
await EventService.RaiseAsync(new UserLoginSuccessEvent(AbpWeChatWorkGlobalConsts.ProviderName, userInfo.UserId, null));
// 登录之后需要更新安全令牌
(await UserManager.UpdateSecurityStampAsync(currentUser)).CheckErrors();
await SetSuccessResultAsync(context, currentUser);
}
catch (AbpWeChatWorkException wwe)

2
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.Sms/LINGYUN/Abp/OpenIddict/Sms/SmsTokenExtensionGrant.cs

@ -116,8 +116,6 @@ public class SmsTokenExtensionGrant : ITokenExtensionGrant
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
}
(await userManager.UpdateSecurityStampAsync(currentUser)).CheckErrors();
return await SetSuccessResultAsync(context, currentUser, logger);
}

3
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat.Work/LINGYUN/Abp/OpenIddict/WeChat/Work/WeChatWorkTokenExtensionGrant.cs

@ -119,9 +119,6 @@ public class WeChatWorkTokenExtensionGrant : ITokenExtensionGrant
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
}
// 登录之后需要更新安全令牌
(await userManager.UpdateSecurityStampAsync(currentUser)).CheckErrors();
return await SetSuccessResultAsync(context, currentUser, userInfo.UserId, logger);
}
catch (AbpWeChatWorkException wwe)

3
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat/LINGYUN/Abp/OpenIddict/WeChat/WeChatTokenExtensionGrant.cs

@ -132,9 +132,6 @@ public abstract class WeChatTokenExtensionGrant : ITokenExtensionGrant
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
}
// 登录之后需要更新安全令牌
(await userManager.UpdateSecurityStampAsync(currentUser)).CheckErrors();
return await SetSuccessResultAsync(context, currentUser, wechatOpenId, logger);
}

1
aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN.Abp.WeChat.SettingManagement.csproj

@ -25,6 +25,7 @@
<ProjectReference Include="..\..\settings\LINGYUN.Abp.SettingManagement.Application.Contracts\LINGYUN.Abp.SettingManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.WeChat.MiniProgram\LINGYUN.Abp.WeChat.MiniProgram.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.WeChat.Official\LINGYUN.Abp.WeChat.Official.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.WeChat.Work\LINGYUN.Abp.WeChat.Work.csproj" />
</ItemGroup>
</Project>

6
aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN/Abp/WeChat/SettingManagement/AbpWeChatSettingManagementModule.cs

@ -1,6 +1,8 @@
using LINGYUN.Abp.WeChat.Localization;
using LINGYUN.Abp.WeChat.MiniProgram;
using LINGYUN.Abp.WeChat.Official;
using LINGYUN.Abp.WeChat.Work;
using LINGYUN.Abp.WeChat.Work.Localization;
using Localization.Resources.AbpUi;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc;
@ -13,6 +15,7 @@ namespace LINGYUN.Abp.WeChat.SettingManagement
[DependsOn(
typeof(AbpWeChatOfficialModule),
typeof(AbpWeChatMiniProgramModule),
typeof(AbpWeChatWorkModule),
typeof(AbpAspNetCoreMvcModule))]
public class AbpWeChatSettingManagementModule : AbpModule
{
@ -43,7 +46,8 @@ namespace LINGYUN.Abp.WeChat.SettingManagement
options.Resources
.Get<WeChatResource>()
.AddBaseTypes(
typeof(AbpUiResource)
typeof(AbpUiResource),
typeof(WeChatWorkResource)
);
});
}

3
aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN/Abp/WeChat/SettingManagement/Localization/Resources/en.json

@ -2,6 +2,7 @@
"culture": "en",
"texts": {
"Permission:WeChat.Official": "Official",
"Permission:WeChat.MiniProgram": "Mini Program"
"Permission:WeChat.MiniProgram": "Mini Program",
"Permission:WeChat.Work": "Work"
}
}

3
aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN/Abp/WeChat/SettingManagement/Localization/Resources/zh-Hans.json

@ -2,6 +2,7 @@
"culture": "zh-Hans",
"texts": {
"Permission:WeChat.Official": "公众平台",
"Permission:WeChat.MiniProgram": "小程序"
"Permission:WeChat.MiniProgram": "小程序",
"Permission:WeChat.Work": "企业微信"
}
}

27
aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN/Abp/WeChat/SettingManagement/WeChatSettingAppService.cs

@ -3,6 +3,7 @@ using LINGYUN.Abp.WeChat.Localization;
using LINGYUN.Abp.WeChat.MiniProgram.Settings;
using LINGYUN.Abp.WeChat.Official.Settings;
using LINGYUN.Abp.WeChat.Settings;
using LINGYUN.Abp.WeChat.Work.Settings;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Authorization.Permissions;
@ -127,6 +128,32 @@ namespace LINGYUN.Abp.WeChat.SettingManagement
settingGroups.AddGroup(wechatSettingGroup);
if (await PermissionChecker.IsGrantedAsync(WeChatSettingPermissionNames.Work))
{
#region 企业微信
var wechatWorkSettingGroup = new SettingGroupDto(L["DisplayName:WeChatWork"], L["Description:WeChatWork"]);
var workLoginSetting = wechatWorkSettingGroup.AddSetting(L["UserLogin"], L["UserLogin"]);
workLoginSetting.AddDetail(
SettingDefinitionManager.Get(WeChatWorkSettingNames.EnabledQuickLogin),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(WeChatWorkSettingNames.EnabledQuickLogin, providerName, providerKey),
ValueType.Boolean,
providerName);
var workConnectionSetting = wechatWorkSettingGroup.AddSetting(L["DisplayName:Connection"], L["Description:Connection"]);
workConnectionSetting.AddDetail(
SettingDefinitionManager.Get(WeChatWorkSettingNames.Connection.CorpId),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(WeChatWorkSettingNames.Connection.CorpId, providerName, providerKey),
ValueType.String,
providerName);
settingGroups.AddGroup(wechatWorkSettingGroup);
#endregion
}
return settingGroups;
}
}

14
aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN/Abp/WeChat/SettingManagement/WeChatSettingPermissionDefinitionProvider.cs

@ -1,5 +1,9 @@
using LINGYUN.Abp.WeChat.Localization;
using LINGYUN.Abp.WeChat.MiniProgram.Features;
using LINGYUN.Abp.WeChat.Official.Features;
using LINGYUN.Abp.WeChat.Work.Features;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Features;
using Volo.Abp.Localization;
namespace LINGYUN.Abp.WeChat.SettingManagement
@ -13,10 +17,16 @@ namespace LINGYUN.Abp.WeChat.SettingManagement
L("Permission:WeChat"));
wechatGroup.AddPermission(
WeChatSettingPermissionNames.Official, L("Permission:WeChat.Official"));
WeChatSettingPermissionNames.Official, L("Permission:WeChat.Official"))
.RequireFeatures(WeChatOfficialFeatures.Enable);
wechatGroup.AddPermission(
WeChatSettingPermissionNames.MiniProgram, L("Permission:WeChat.MiniProgram"));
WeChatSettingPermissionNames.MiniProgram, L("Permission:WeChat.MiniProgram"))
.RequireFeatures(WeChatMiniProgramFeatures.Enable);
wechatGroup.AddPermission(
WeChatSettingPermissionNames.Work, L("Permission:WeChat.Work"))
.RequireFeatures(WeChatWorkFeatureNames.Enable);
}
protected LocalizableString L(string name)

1
aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN/Abp/WeChat/SettingManagement/WeChatSettingPermissionNames.cs

@ -6,5 +6,6 @@
public const string Official = GroupName + ".Official";
public const string MiniProgram = GroupName + ".MiniProgram";
public const string Work = GroupName + ".Work";
}
}

4
aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Localization/Resources/en.json

@ -18,6 +18,10 @@
"Features:AppChatMessage.LimitDesc": "设置以限制企业微信群聊消息推送上限.",
"Features:AppChatMessage.LimitInterval": "企业微信群聊消息限制周期",
"Features:AppChatMessage.LimitIntervalDesc": "设置企业微信群聊消息限制周期(时间刻度: 分).每企业所有应用发送群消息不可超过2万人次/分,不可超过30万人次/小时.",
"DisplayName:WeChatWork": "企业微信",
"Description:WeChatWork": "企业微信应用集成",
"DisplayName:Connection": "连接参数",
"Description:Connection": "企业微信连接参数",
"DisplayName:WeChatWork.Connection.CorpId": "Corp Id",
"Description:WeChatWork.Connection.CorpId": "Each enterprise has a unique corpid, to obtain this information, you can view \"Enterprise ID\" under \"My Enterprise\" - \"Enterprise Information\" in the management background (requires administrator permissions).",
"DisplayName:WeChatWork.EnabledQuickLogin": "Enabled Quick Login",

4
aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Localization/Resources/zh-Hans.json

@ -18,6 +18,10 @@
"Features:AppChatMessage.LimitDesc": "设置以限制企业微信群聊消息推送上限.",
"Features:AppChatMessage.LimitInterval": "企业微信群聊消息限制周期",
"Features:AppChatMessage.LimitIntervalDesc": "设置企业微信群聊消息限制周期(时间刻度: 分).每企业所有应用发送群消息不可超过2万人次/分,不可超过30万人次/小时.",
"DisplayName:WeChatWork": "企业微信",
"Description:WeChatWork": "企业微信应用集成",
"DisplayName:Connection": "连接参数",
"Description:Connection": "企业微信连接参数",
"DisplayName:WeChatWork.Connection.CorpId": "企业Id",
"Description:WeChatWork.Connection.CorpId": "每个企业都拥有唯一的corpid,获取此信息可在管理后台“我的企业”-“企业信息”下查看“企业ID”(需要有管理员权限)",
"DisplayName:WeChatWork.EnabledQuickLogin": "启用快捷登录",

2
aspnet-core/modules/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Settings/WeChatWorkSettingDefinitionProvider.cs

@ -34,7 +34,7 @@ namespace LINGYUN.Abp.WeChat.Work.Settings
WeChatWorkSettingNames.Connection.CorpId,
displayName: L("DisplayName:WeChatWork.Connection.CorpId"),
description: L("Description:WeChatWork.Connection.CorpId"),
isEncrypted: false)
isEncrypted: true)
.WithProviders(
DefaultValueSettingValueProvider.ProviderName,
ConfigurationSettingValueProvider.ProviderName,

4
aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/BackgroundJobs/NotificationPublishJobArgs.cs

@ -10,6 +10,10 @@ public class NotificationPublishJobArgs
public long NotificationId { get; set; }
public string ProviderType { get; set; }
public List<UserIdentifier> UserIdentifiers { get; set; }
public NotificationPublishJobArgs()
{
UserIdentifiers = new List<UserIdentifier>();
}
public NotificationPublishJobArgs(long id, string providerType, List<UserIdentifier> userIdentifiers, Guid? tenantId = null)
{
NotificationId = id;

Loading…
Cancel
Save