public void ProcessRequest(GDPRMessage message) { this.Request = message; GDPRSubject s = new GDPRSubject(message.Subject); switch (message.GetType().Name) { case "DeleteMessage": this.RecordDeleteIn(message.Subject); break; case "DataRequestMessage": List <GDPRSubject> customers = this.RecordSearch(s); foreach (GDPRSubject c in customers) { string storageLocation = this.ExportData(c.ApplicationSubjectId); //send a export message... ExportMessage em = new ExportMessage(); em.ApplicationId = Request.ApplicationId; em.ApplicationSubjectId = c.ApplicationSubjectId; em.SubjectRequestId = Request.SubjectRequestId; em.Subject = Request.Subject; em.BlobUrl = storageLocation; this.Response = em; MasterGDPRHelper.SendMessage(em); } break; } }
public string SubjectHold([FromUri] string applicationId, [FromUri] string subjectId, [FromUri] string emailAddress) { try { GDPRMessage msg = new GDPRMessage(); HoldMessage dm = new HoldMessage(); dm.ApplicationId = applicationId; dm.ApplicationSubjectId = subjectId; dm.Direction = "in"; msg = dm; GDPRSubject s = new GDPRSubject(); s.Email = emailAddress; msg.Subject = s; MasterGDPRHelper.SendMessage(msg); } catch { return("Failure"); } return("Success"); }
public static void Run([EventHubTrigger("gdprmessagehub", Connection = "EventHubConnectionAppSetting")] EventData myEventHubMessage, TraceWriter log) { string data = Encoding.UTF8.GetString(myEventHubMessage.GetBytes()); log.Info($"{data}"); GDPRMessageWrapper message = (GDPRMessageWrapper)Newtonsoft.Json.JsonConvert.DeserializeObject(data); MasterGDPRHelper.ProcessRequest(message); }
public string CreateGDPRRequest([FromUri] string emailAddress, [FromUri] string type) { try { return(MasterGDPRHelper.CreateGDPRRequest(emailAddress, type)); } catch { return("Failure"); } }
private static async Task MainAsync(string consumerGroup) { System.Console.WriteLine("Registering EventProcessor..."); MasterGDPRHelper.StartMessageProcessing(consumerGroup, out EventProcessorHost eventProcessorHost); System.Console.WriteLine("Receiving. Press ENTER to stop worker."); System.Console.ReadLine(); // Disposes of the Event Processor Host await eventProcessorHost.UnregisterEventProcessorAsync(); }
void GetAllRecords() { List <Customer> customers = e.Customers.ToList(); foreach (Customer c in customers) { CreateMessage cm = new CreateMessage(); cm.ApplicationSubjectId = c.CustomerId.ToString(); cm.ApplicationId = this.ApplicationId.ToString(); MasterGDPRHelper.SendMessage(cm); } }
public ActionResult Consents() { GDPRDatabaseEntities e = Util.GetGDPRDBContext(Util.GDPRSQLConnectionString); SetupViewBag(ViewBag); GDPRSubject s = new GDPRSubject(); s.Email = this.User.Identity.Name; string subjectId = MasterGDPRHelper.FindSubject(s).SubjectId.ToString(); List <GDPRSubjectRequestApplication> requests = e.Database.SqlQuery <GDPRSubjectRequestApplication>("select sar.* from SubjectRequest sr, SubjectRequestApplication sar where sr.subjectrequestid = sar.subjectrequestid and sr.subjectid = '" + subjectId + "'").ToList(); ViewBag.Requests = requests; return(View()); }
static void CheckForChanges() { foreach (Application a in MasterGDPRHelper.GDPRDatabase.Applications) { if (a.IsActive) { Type t = Type.GetType(a.ProcessorClass + ",GDPR.Util"); GDPRApplication app = (GDPRApplication)Activator.CreateInstance(t); List <GDPRMessage> messages = app.GetChanges(a.ChangeDate); foreach (GDPRMessage msg in messages) { MasterGDPRHelper.SendMessage(msg); } MasterGDPRHelper.UpdateApplicationChangeDate(a.ApplicationId, DateTime.Now); } } }
public override bool Process() { //Save the application request for future status update MasterGDPRHelper.SaveApplicationRequest(this); Application app = MasterGDPRHelper.GDPRDatabase.Applications.Find(Guid.Parse(this.ApplicationId)); if (app.IsActive) { string typeclass = app.ProcessorClass; //initalize the Application stub Type pType = Type.GetType(typeclass); Application = (GDPRApplication)Activator.CreateInstance(pType); //fire the request Application.ProcessRequest(this); } return(base.Process()); }
static void Main(string[] args) { //create the user in the system... Setup(); //Check for new additions (non http outgoing trigger based system like Azure SQL) CheckForChanges(); //send a notify message... NotifyMessage nm = new NotifyMessage(); nm.Direction = "out"; GDPRSubject s = new GDPRSubject(); s.Email = "*****@*****.**"; nm.Subject = s; nm.Title = "CRM Compromised"; nm.ShortMessage = "CRM Compromised"; nm.LongMessage = "As of this morning we have noticed abnormal activity in our system that looks hacker related. We will notify you of future updates."; MasterGDPRHelper.SendMessage(nm); //send me my data request... DataSubjectQueryMessage dsqm = new DataSubjectQueryMessage(); s = new GDPRSubject(); s.Email = "*****@*****.**"; dsqm.Subject = s; MasterGDPRHelper.SendMessage(dsqm); //delete request... DataSubjectDeleteMessage dsdm = new DataSubjectDeleteMessage(); s = new GDPRSubject(); s.Email = "*****@*****.**"; dsdm.Subject = s; MasterGDPRHelper.SendMessage(dsdm); }
public override bool Process() { this.SubjectRequestId = MasterGDPRHelper.SaveConsumerRequest(this).ToString(); return(base.Process()); }
public ActionResult GDPRRequestPost(string type) { MasterGDPRHelper.CreateGDPRRequest(this.User.Identity.Name, type); return(View("Index", "Home")); }