Add `UserDeletedEventHandler`.

pull/18051/head
maliming 1 year ago
parent a750f0039d
commit bcf65ab18d
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4

@ -16,6 +16,7 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Identity.Domain.Shared\Volo.Abp.Identity.Domain.Shared.csproj" />
<ProjectReference Include="..\..\..\users\src\Volo.Abp.Users.Abstractions\Volo.Abp.Users.Abstractions.csproj" />
<ProjectReference Include="..\..\..\permission-management\src\Volo.Abp.PermissionManagement.Domain\Volo.Abp.PermissionManagement.Domain.csproj" />
</ItemGroup>

@ -1,13 +1,15 @@
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Identity;
using Volo.Abp.Modularity;
using Volo.Abp.Users;
namespace Volo.Abp.PermissionManagement.Identity;
[DependsOn(
typeof(AbpIdentityDomainSharedModule),
typeof(AbpPermissionManagementDomainModule)
)]
typeof(AbpPermissionManagementDomainModule),
typeof(AbpUsersAbstractionModule)
)]
public class AbpPermissionManagementDomainIdentityModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)

@ -0,0 +1,25 @@
using System.Threading.Tasks;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Users;
namespace Volo.Abp.PermissionManagement.Identity;
public class UserDeletedEventHandler :
IDistributedEventHandler<EntityDeletedEto<UserEto>>,
ITransientDependency
{
protected IPermissionManager PermissionManager { get; }
public UserDeletedEventHandler(IPermissionManager permissionManager)
{
PermissionManager = permissionManager;
}
public async Task HandleEventAsync(EntityDeletedEto<UserEto> eventData)
{
await PermissionManager.DeleteAsync(UserPermissionValueProvider.ProviderName, eventData.Entity.Name);
}
}
Loading…
Cancel
Save