-
Notifications
You must be signed in to change notification settings - Fork 23
Users/saprajap/gdprdatamapping #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sanjayprajap
wants to merge
8
commits into
main
Choose a base branch
from
users/saprajap/gdprdatamapping
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4b3c97b
EMail-Notificationid mapping functionality for GDPR implementation.
ab94aa8
merged changes from main
ae4d9d7
bug fixes
0a7c1f1
code fixes and method renamed
1286495
Unit Test cases
67ed456
unit test case failure fixed
99f6bd8
merged code from Main branch
cb9e8e2
stylecop issue fix with #pragma
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
264 changes: 264 additions & 0 deletions
264
NotificationService/GDPRNotificationMappingProcessor/.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,264 @@ | ||
| ## Ignore Visual Studio temporary files, build results, and | ||
| ## files generated by popular Visual Studio add-ons. | ||
|
|
||
| # Azure Functions localsettings file | ||
| local.settings.json | ||
|
|
||
| # User-specific files | ||
| *.suo | ||
| *.user | ||
| *.userosscache | ||
| *.sln.docstates | ||
|
|
||
| # User-specific files (MonoDevelop/Xamarin Studio) | ||
| *.userprefs | ||
|
|
||
| # Build results | ||
| [Dd]ebug/ | ||
| [Dd]ebugPublic/ | ||
| [Rr]elease/ | ||
| [Rr]eleases/ | ||
| x64/ | ||
| x86/ | ||
| bld/ | ||
| [Bb]in/ | ||
| [Oo]bj/ | ||
| [Ll]og/ | ||
|
|
||
| # Visual Studio 2015 cache/options directory | ||
| .vs/ | ||
| # Uncomment if you have tasks that create the project's static files in wwwroot | ||
| #wwwroot/ | ||
|
|
||
| # MSTest test Results | ||
| [Tt]est[Rr]esult*/ | ||
| [Bb]uild[Ll]og.* | ||
|
|
||
| # NUNIT | ||
| *.VisualState.xml | ||
| TestResult.xml | ||
|
|
||
| # Build Results of an ATL Project | ||
| [Dd]ebugPS/ | ||
| [Rr]eleasePS/ | ||
| dlldata.c | ||
|
|
||
| # DNX | ||
| project.lock.json | ||
| project.fragment.lock.json | ||
| artifacts/ | ||
|
|
||
| *_i.c | ||
| *_p.c | ||
| *_i.h | ||
| *.ilk | ||
| *.meta | ||
| *.obj | ||
| *.pch | ||
| *.pdb | ||
| *.pgc | ||
| *.pgd | ||
| *.rsp | ||
| *.sbr | ||
| *.tlb | ||
| *.tli | ||
| *.tlh | ||
| *.tmp | ||
| *.tmp_proj | ||
| *.log | ||
| *.vspscc | ||
| *.vssscc | ||
| .builds | ||
| *.pidb | ||
| *.svclog | ||
| *.scc | ||
|
|
||
| # Chutzpah Test files | ||
| _Chutzpah* | ||
|
|
||
| # Visual C++ cache files | ||
| ipch/ | ||
| *.aps | ||
| *.ncb | ||
| *.opendb | ||
| *.opensdf | ||
| *.sdf | ||
| *.cachefile | ||
| *.VC.db | ||
| *.VC.VC.opendb | ||
|
|
||
| # Visual Studio profiler | ||
| *.psess | ||
| *.vsp | ||
| *.vspx | ||
| *.sap | ||
|
|
||
| # TFS 2012 Local Workspace | ||
| $tf/ | ||
|
|
||
| # Guidance Automation Toolkit | ||
| *.gpState | ||
|
|
||
| # ReSharper is a .NET coding add-in | ||
| _ReSharper*/ | ||
| *.[Rr]e[Ss]harper | ||
| *.DotSettings.user | ||
|
|
||
| # JustCode is a .NET coding add-in | ||
| .JustCode | ||
|
|
||
| # TeamCity is a build add-in | ||
| _TeamCity* | ||
|
|
||
| # DotCover is a Code Coverage Tool | ||
| *.dotCover | ||
|
|
||
| # NCrunch | ||
| _NCrunch_* | ||
| .*crunch*.local.xml | ||
| nCrunchTemp_* | ||
|
|
||
| # MightyMoose | ||
| *.mm.* | ||
| AutoTest.Net/ | ||
|
|
||
| # Web workbench (sass) | ||
| .sass-cache/ | ||
|
|
||
| # Installshield output folder | ||
| [Ee]xpress/ | ||
|
|
||
| # DocProject is a documentation generator add-in | ||
| DocProject/buildhelp/ | ||
| DocProject/Help/*.HxT | ||
| DocProject/Help/*.HxC | ||
| DocProject/Help/*.hhc | ||
| DocProject/Help/*.hhk | ||
| DocProject/Help/*.hhp | ||
| DocProject/Help/Html2 | ||
| DocProject/Help/html | ||
|
|
||
| # Click-Once directory | ||
| publish/ | ||
|
|
||
| # Publish Web Output | ||
| *.[Pp]ublish.xml | ||
| *.azurePubxml | ||
| # TODO: Comment the next line if you want to checkin your web deploy settings | ||
| # but database connection strings (with potential passwords) will be unencrypted | ||
| #*.pubxml | ||
| *.publishproj | ||
|
|
||
| # Microsoft Azure Web App publish settings. Comment the next line if you want to | ||
| # checkin your Azure Web App publish settings, but sensitive information contained | ||
| # in these scripts will be unencrypted | ||
| PublishScripts/ | ||
|
|
||
| # NuGet Packages | ||
| *.nupkg | ||
| # The packages folder can be ignored because of Package Restore | ||
| **/packages/* | ||
| # except build/, which is used as an MSBuild target. | ||
| !**/packages/build/ | ||
| # Uncomment if necessary however generally it will be regenerated when needed | ||
| #!**/packages/repositories.config | ||
| # NuGet v3's project.json files produces more ignoreable files | ||
| *.nuget.props | ||
| *.nuget.targets | ||
|
|
||
| # Microsoft Azure Build Output | ||
| csx/ | ||
| *.build.csdef | ||
|
|
||
| # Microsoft Azure Emulator | ||
| ecf/ | ||
| rcf/ | ||
|
|
||
| # Windows Store app package directories and files | ||
| AppPackages/ | ||
| BundleArtifacts/ | ||
| Package.StoreAssociation.xml | ||
| _pkginfo.txt | ||
|
|
||
| # Visual Studio cache files | ||
| # files ending in .cache can be ignored | ||
| *.[Cc]ache | ||
| # but keep track of directories ending in .cache | ||
| !*.[Cc]ache/ | ||
|
|
||
| # Others | ||
| ClientBin/ | ||
| ~$* | ||
| *~ | ||
| *.dbmdl | ||
| *.dbproj.schemaview | ||
| *.jfm | ||
| *.pfx | ||
| *.publishsettings | ||
| node_modules/ | ||
| orleans.codegen.cs | ||
|
|
||
| # Since there are multiple workflows, uncomment next line to ignore bower_components | ||
| # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) | ||
| #bower_components/ | ||
|
|
||
| # RIA/Silverlight projects | ||
| Generated_Code/ | ||
|
|
||
| # Backup & report files from converting an old project file | ||
| # to a newer Visual Studio version. Backup files are not needed, | ||
| # because we have git ;-) | ||
| _UpgradeReport_Files/ | ||
| Backup*/ | ||
| UpgradeLog*.XML | ||
| UpgradeLog*.htm | ||
|
|
||
| # SQL Server files | ||
| *.mdf | ||
| *.ldf | ||
|
|
||
| # Business Intelligence projects | ||
| *.rdl.data | ||
| *.bim.layout | ||
| *.bim_*.settings | ||
|
|
||
| # Microsoft Fakes | ||
| FakesAssemblies/ | ||
|
|
||
| # GhostDoc plugin setting file | ||
| *.GhostDoc.xml | ||
|
|
||
| # Node.js Tools for Visual Studio | ||
| .ntvs_analysis.dat | ||
|
|
||
| # Visual Studio 6 build log | ||
| *.plg | ||
|
|
||
| # Visual Studio 6 workspace options file | ||
| *.opt | ||
|
|
||
| # Visual Studio LightSwitch build output | ||
| **/*.HTMLClient/GeneratedArtifacts | ||
| **/*.DesktopClient/GeneratedArtifacts | ||
| **/*.DesktopClient/ModelManifest.xml | ||
| **/*.Server/GeneratedArtifacts | ||
| **/*.Server/ModelManifest.xml | ||
| _Pvt_Extensions | ||
|
|
||
| # Paket dependency manager | ||
| .paket/paket.exe | ||
| paket-files/ | ||
|
|
||
| # FAKE - F# Make | ||
| .fake/ | ||
|
|
||
| # JetBrains Rider | ||
| .idea/ | ||
| *.sln.iml | ||
|
|
||
| # CodeRush | ||
| .cr/ | ||
|
|
||
| # Python Tools for Visual Studio (PTVS) | ||
| __pycache__/ | ||
| *.pyc |
22 changes: 22 additions & 0 deletions
22
NotificationService/GDPRNotificationMappingProcessor/Constants.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace GDPRNotificationMappingProcessor | ||
| { | ||
|
|
||
| /// <summary> | ||
| /// class for constant literals. | ||
| /// </summary> | ||
| public sealed class Constants | ||
| { | ||
| /// <summary> | ||
| /// StorageType. | ||
| /// </summary> | ||
| public const string StorageType = "StorageType"; | ||
|
|
||
| /// <summary> | ||
| /// Seconds to wait between attempts at polling the Azure KeyVault for changes in configuration. | ||
| /// </summary> | ||
| public const string KeyVaultConfigRefreshDurationSeconds = "KeyVaultConfigRefreshDurationSeconds"; | ||
| } | ||
| } |
97 changes: 97 additions & 0 deletions
97
NotificationService/GDPRNotificationMappingProcessor/GDPRNotificationMappingProcessor.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace GDPRNotificationMappingProcessor | ||
| { | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using Microsoft.Azure.WebJobs; | ||
| using Microsoft.Extensions.Configuration; | ||
| using Microsoft.OData.Edm.Vocabularies; | ||
| using Newtonsoft.Json; | ||
| using NotificationService.Common.Logger; | ||
| using NotificationService.Contracts; | ||
| using NotificationService.Contracts.Models.GDPR; | ||
| using NotificationService.Data; | ||
| using NotificationService.Data.Interfaces; | ||
|
|
||
| /// <summary> | ||
| /// Function to process notification messages and create emailId and NotificationId mapping for GDPR scrubbing. | ||
| /// </summary> | ||
| public class GDPRNotificationMappingProcessor | ||
| { | ||
| /// <summary> | ||
| /// The logger. | ||
| /// </summary> | ||
| private readonly ILogger logger; | ||
|
|
||
| /// <summary> | ||
| /// Instance of <see cref="IEmailNotificationRepository"/>. | ||
| /// </summary> | ||
| private readonly IEmailNotificationRepository emailNotificationRepository; | ||
|
|
||
| /// <summary> | ||
| /// Instance of Application Configuration. | ||
| /// </summary> | ||
| private readonly IConfiguration configuration; | ||
|
|
||
| /// <summary> | ||
| /// Enum to specify type of database. | ||
| /// </summary> | ||
| private readonly StorageType repo; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="GDPRNotificationMappingProcessor"/> class. | ||
| /// </summary> | ||
| /// <param name="logger">The log.</param> | ||
| /// <param name="configuration">The configuration.</param> | ||
| /// <param name="repositoryFactory">The repositoryFactory.</param> | ||
| public GDPRNotificationMappingProcessor( | ||
| ILogger logger, | ||
| IConfiguration configuration, | ||
| IRepositoryFactory repositoryFactory) | ||
| { | ||
| this.logger = logger; | ||
| this.configuration = configuration; | ||
| this.emailNotificationRepository = repositoryFactory.GetRepository(Enum.TryParse<StorageType>(this.configuration?[Constants.StorageType], out this.repo) ? this.repo : throw new Exception()); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Trigger method invoked when a notification item is added to the queue. | ||
| /// </summary> | ||
| /// <param name="message">Serialized queue item.</param> | ||
| [FunctionName("GDPRNotificationMappingProcessor")] | ||
| public void Run([QueueTrigger("%GdprNotifEmailMapQueueName%", Connection = "AzureWebJobsStorage")]string message) | ||
| { | ||
| if (string.IsNullOrEmpty(message)) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| this.logger.TraceInformation($"Started processing notificaiton to create emailid-notificationid mapping."); | ||
| NotificationMappingQueueItem item = JsonConvert.DeserializeObject<NotificationMappingQueueItem>(message); | ||
| NotificationType notifType = (NotificationType)Enum.Parse(typeof(NotificationType), item.NotificationType); | ||
| var payloadJson = item.Payload?.ToString(); | ||
|
|
||
| if (string.IsNullOrEmpty(payloadJson)) | ||
| { | ||
| this.logger.TraceError($"Notification Payload for type {item.NotificationType} can't be null or empty"); | ||
| return; | ||
| } | ||
|
|
||
| this.logger.TraceInformation($"processing notification mapping for notification type {item.NotificationType}"); | ||
| if (notifType == NotificationType.Mail) | ||
| { | ||
| var entities = JsonConvert.DeserializeObject<List<EmailNotificationQueueItem>>(payloadJson); | ||
| this.emailNotificationRepository.CreateEmailIdNotificationMappingForEmail(entities, item.ApplicationName); | ||
| } | ||
| else | ||
| { | ||
| var entities = JsonConvert.DeserializeObject<List<MeetingNotificationQueueItem>>(payloadJson); | ||
| this.emailNotificationRepository.CreateEmailIdNotificationMappingForMeetingInvite(entities, item.ApplicationName); | ||
| } | ||
|
|
||
| this.logger.TraceInformation($"Finished processing notificaiton for type {item.NotificationType} to create emailid-notificationid mapping."); | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.