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.
28 lines
825 B
28 lines
825 B
using System.Threading.Tasks;
|
|
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.AuthServer.Handlers;
|
|
|
|
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);
|
|
}
|
|
}
|
|
|