mirror of https://github.com/abpframework/abp.git
13 changed files with 172 additions and 0 deletions
@ -0,0 +1,3 @@ |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait /> |
|||
</Weavers> |
|||
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
|||
<xs:element name="Weavers"> |
|||
<xs:complexType> |
|||
<xs:all> |
|||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
|||
<xs:complexType> |
|||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:all> |
|||
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
|||
<xs:annotation> |
|||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:schema> |
|||
@ -0,0 +1,15 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\configureawait.props" /> |
|||
<Import Project="..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Volo.Abp.EventBus\Volo.Abp.EventBus.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,9 @@ |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.Gdpr; |
|||
|
|||
[DependsOn(typeof(AbpEventBusModule))] |
|||
public class AbpGdprAbstractionsModule : AbpModule |
|||
{ |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.Gdpr; |
|||
|
|||
[Serializable] |
|||
public class GdprDataInfo : Dictionary<string, string> |
|||
{ |
|||
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.Gdpr; |
|||
|
|||
[Serializable] |
|||
public class GdprUserDataDeleteRequestedEto |
|||
{ |
|||
public Guid UserId { get; set; } |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.Gdpr; |
|||
|
|||
[Serializable] |
|||
public class GdprUserDataPreparedEto |
|||
{ |
|||
public Guid RequestId { get; set; } |
|||
|
|||
public string Provider { get; set; } |
|||
|
|||
public GdprDataInfo Data { get; set; } |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Volo.Abp.Gdpr; |
|||
|
|||
public abstract class GdprUserDataProviderBase : IGdprUserDataProvider |
|||
{ |
|||
public abstract Task<GdprDataInfo> GetAsync(GdprUserDataProviderContext context); |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.Gdpr; |
|||
|
|||
public class GdprUserDataProviderContext |
|||
{ |
|||
public Guid UserId { get; set; } |
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
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 |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.Gdpr; |
|||
|
|||
[Serializable] |
|||
public class GdprUserDataRequestedEto |
|||
{ |
|||
public Guid UserId { get; set; } |
|||
|
|||
public Guid RequestId { get; set; } |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Volo.Abp.Gdpr; |
|||
|
|||
public interface IGdprUserDataProvider |
|||
{ |
|||
Task<GdprDataInfo> GetAsync(GdprUserDataProviderContext context); |
|||
} |
|||
Loading…
Reference in new issue