这是基于vue-vben-admin 模板适用于abp vNext的前端管理项目
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.
 
 
 
 
 
 

27 lines
816 B

using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Identity;
using Volo.Abp.Uow;
using Volo.Abp.Users;
namespace LY.MicroService.Applications.Single.EventBus.Distributed;
public class IdentityUserChangedEventHandler :
IDistributedEventHandler<EntityCreatedEto<UserEto>>,
ITransientDependency
{
protected IdentityUserManager UserManager { get; }
public IdentityUserChangedEventHandler(IdentityUserManager userManager)
{
UserManager = userManager;
}
[UnitOfWork]
public async virtual Task HandleEventAsync(EntityCreatedEto<UserEto> eventData)
{
var user = await UserManager.GetByIdAsync(eventData.Entity.Id);
await UserManager.AddDefaultRolesAsync(user);
}
}