You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.6 KiB
39 lines
1.6 KiB
using Volo.Abp.DependencyInjection;
|
|
using Volo.Abp.Domain.Entities.Events;
|
|
using Volo.Abp.Users;
|
|
|
|
namespace LY.MicroService.Applications.Single.EventBus.Local;
|
|
|
|
public class UserCreateSubscribeIdentityNotificationsEventHandler : ILocalEventHandler<EntityCreatedEventData<UserEto>>, ITransientDependency
|
|
{
|
|
private readonly INotificationSubscriptionManager _notificationSubscriptionManager;
|
|
public UserCreateSubscribeIdentityNotificationsEventHandler(
|
|
INotificationSubscriptionManager notificationSubscriptionManager
|
|
)
|
|
{
|
|
_notificationSubscriptionManager = notificationSubscriptionManager;
|
|
}
|
|
|
|
public async virtual Task HandleEventAsync(EntityCreatedEventData<UserEto> eventData)
|
|
{
|
|
var userIdentifer = new UserIdentifier(eventData.Entity.Id, eventData.Entity.UserName);
|
|
// 订阅用户会话过期通知
|
|
await _notificationSubscriptionManager
|
|
.SubscribeAsync(
|
|
eventData.Entity.TenantId,
|
|
userIdentifer,
|
|
IdentityNotificationNames.Session.ExpirationSession);
|
|
// 订阅用户账号不活跃通知
|
|
await _notificationSubscriptionManager
|
|
.SubscribeAsync(
|
|
eventData.Entity.TenantId,
|
|
userIdentifer,
|
|
IdentityNotificationNames.IdentityUser.InactiveUserReminderNotifier);
|
|
// 订阅用户账号停用通知
|
|
await _notificationSubscriptionManager
|
|
.SubscribeAsync(
|
|
eventData.Entity.TenantId,
|
|
userIdentifer,
|
|
IdentityNotificationNames.IdentityUser.InactiveUserDeactivationNotifier);
|
|
}
|
|
}
|
|
|