diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo.Abp.PermissionManagement.Domain.Identity.csproj b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo.Abp.PermissionManagement.Domain.Identity.csproj index 30018df86e..35ce121c09 100644 --- a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo.Abp.PermissionManagement.Domain.Identity.csproj +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo.Abp.PermissionManagement.Domain.Identity.csproj @@ -16,6 +16,7 @@ + diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/AbpPermissionManagementDomainIdentityModule.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/AbpPermissionManagementDomainIdentityModule.cs index e710d5b165..973577ccff 100644 --- a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/AbpPermissionManagementDomainIdentityModule.cs +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/AbpPermissionManagementDomainIdentityModule.cs @@ -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) diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/UserDeletedEventHandler.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/UserDeletedEventHandler.cs new file mode 100644 index 0000000000..f44373cbda --- /dev/null +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/UserDeletedEventHandler.cs @@ -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>, + ITransientDependency +{ + protected IPermissionManager PermissionManager { get; } + + public UserDeletedEventHandler(IPermissionManager permissionManager) + { + PermissionManager = permissionManager; + } + + public async Task HandleEventAsync(EntityDeletedEto eventData) + { + await PermissionManager.DeleteAsync(UserPermissionValueProvider.ProviderName, eventData.Entity.Name); + } +}