mirror of https://github.com/abpframework/abp.git
5 changed files with 2 additions and 61 deletions
@ -1,9 +1,7 @@ |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.Gdpr; |
|||
|
|||
[DependsOn(typeof(AbpEventBusModule))] |
|||
public class AbpGdprAbstractionsModule : AbpModule |
|||
{ |
|||
} |
|||
@ -1,8 +0,0 @@ |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Volo.Abp.Gdpr; |
|||
|
|||
public abstract class GdprUserDataProviderBase : IGdprUserDataProvider |
|||
{ |
|||
public abstract Task<GdprDataInfo> GetAsync(GdprUserDataProviderContext context); |
|||
} |
|||
@ -1,41 +0,0 @@ |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
|
|||
namespace Volo.Abp.Gdpr; |
|||
|
|||
public class GdprUserDataRequestEventHandler |
|||
: IDistributedEventHandler<GdprUserDataRequestedEto>, ITransientDependency |
|||
{ |
|||
protected IServiceScopeFactory ServiceScopeFactory { get; } |
|||
protected IDistributedEventBus EventBus { get; } |
|||
|
|||
public GdprUserDataRequestEventHandler(IServiceScopeFactory serviceScopeFactory, IDistributedEventBus eventBus) |
|||
{ |
|||
ServiceScopeFactory = serviceScopeFactory; |
|||
EventBus = eventBus; |
|||
} |
|||
|
|||
public async Task HandleEventAsync(GdprUserDataRequestedEto eventData) |
|||
{ |
|||
using (var scope = ServiceScopeFactory.CreateScope()) |
|||
{ |
|||
var gdprDataProviders = scope.ServiceProvider.GetServices<IGdprUserDataProvider>().ToList(); |
|||
|
|||
foreach (var gdprDataProvider in gdprDataProviders) |
|||
{ |
|||
var gdprDataInfo = await gdprDataProvider.GetAsync(new GdprUserDataProviderContext { UserId = eventData.UserId}); |
|||
|
|||
await EventBus.PublishAsync( |
|||
new GdprUserDataPreparedEto |
|||
{ |
|||
RequestId = eventData.RequestId, |
|||
Data = gdprDataInfo, |
|||
Provider = gdprDataProvider.GetType().FullName |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,8 +0,0 @@ |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Volo.Abp.Gdpr; |
|||
|
|||
public interface IGdprUserDataProvider |
|||
{ |
|||
Task<GdprDataInfo> GetAsync(GdprUserDataProviderContext context); |
|||
} |
|||
Loading…
Reference in new issue