Skip to content

Commit 6b8b3e6

Browse files
committed
scheduler
1 parent 85f61a4 commit 6b8b3e6

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

Componants/LocalUtils.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ public static string SaveData(NBrightInfo ajaxInfo)
4646
info.SetXmlProperty("genxml/checkbox/active", ajaxInfo.GetXmlProperty("genxml/checkbox/active"));
4747
info.SetXmlProperty("genxml/checkbox/autoremoveusers", ajaxInfo.GetXmlProperty("genxml/checkbox/autoremoveusers"));
4848
info.SetXmlProperty("genxml/checkbox/debugmode", ajaxInfo.GetXmlProperty("genxml/checkbox/debugmode"));
49+
var editlang = ajaxInfo.GetXmlProperty("genxml/hidden/editlang");
50+
var lastrun = ajaxInfo.GetXmlProperty("genxml/textbox/lastrun");
51+
if (Utils.IsDate(lastrun, editlang))
52+
{
53+
var cultureInfo = new CultureInfo(editlang, true);
54+
var lastrundate = Convert.ToDateTime(lastrun, cultureInfo);
55+
lastrundate = lastrundate.Date.AddMinutes(130); // Make it 2:10 in the morning so scheudler runs if testing.
56+
info.SetXmlProperty("genxml/textbox/lastrun", lastrundate.ToString("O"), TypeCode.DateTime);
57+
}
4958
}
5059
objCtrl.Update(info);
5160
DataCache.ClearCache();
@@ -76,19 +85,28 @@ public static void ExecuteGDPR()
7685
}
7786
public static void SchedulerActionGDPR(int portalId)
7887
{
88+
LogSystem("OS_GDPR - Scheduler: " + DateTime.Now.ToString());
7989
var objCtrl = new NBrightBuyController();
8090
var info = objCtrl.GetByGuidKey(portalId, -1, "OS_GDPRDATA", "OS_GDPRDATA");
8191
var strlastrun = info.GetXmlProperty("genxml/textbox/lastrun");
82-
if (Utils.IsDate(strlastrun,"en-US"))
92+
var debugmode = info.GetXmlPropertyBool("genxml/checkbox/debugmode");
93+
if (Utils.IsDate(strlastrun))
8394
{
8495
var lastrun = Convert.ToDateTime(strlastrun);
8596
// run between 2am - 3am, once a day.
8697
if ((lastrun < DateTime.Now.Date && DateTime.Now > DateTime.Now.Date.AddHours(2)))
8798
{
8899
LogSystem("OS_GDPR --------------- START Scheduler ---------------");
89-
LogSystem("OS_GDPR - Scheduler: " + DateTime.Now.ToString());
90100
ActionGDPR(portalId);
91101
}
102+
else
103+
{
104+
LogSystem("OS_GDPR - Scheduler: Invalid Date Time (2am - 3am required)");
105+
}
106+
}
107+
else
108+
{
109+
LogSystem("OS_GDPR - Scheduler: Invalid Last Run Date.");
92110
}
93111
}
94112

DNNpackager.dnnpack

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
</file>
2626
<assembly>
2727
<value>\bin\OS_GDPR.dll</value>
28+
<value>\bin\OS_GDPR.pdb</value>
2829
</assembly>
2930
</root>

Docs/os_gdpr_docs.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,7 @@ The Scheduler is setup and creates a list of users that should be removed. Manu
139139

140140
A list of users that need to be removed is created when the "Execute Button" is clicked in the UI. After that users can be removed via the UI.
141141

142+
#### Remove Single User
143+
If a client demands to be removed, the UI allows you to search for a user, but email or partial email.
144+
Clicking the "Execute" button will activate the search and add the user to the UI list, it can then be manualy removed. (If the user exists in the system)
145+

Themes/config/default/datafields.cshtml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
@using NBrightDNN
66
@using DotNetNuke.Entities.Users;
77
@using System.Xml;
8+
@using NBrightCore.common;
89

910
@AddMetaData("resourcepath", "/DesktopModules/NBright/NBrightBuy/App_LocalResources/")
1011
@AddMetaData("resourcepath", "/DesktopModules/NBright/OS_GDPR/App_LocalResources/")
@@ -23,7 +24,7 @@
2324

2425

2526
<input id="itemid" type="hidden" value="@info.ItemID" />
26-
<input id="editlang" type="hidden" value="@info.Lang" />
27+
<input id="editlang" type="hidden" value="@Utils.GetCurrentCulture()" />
2728

2829
<div class="col-xs-12 col-sm-12">
2930
<div class="form-group depotdetail">
@@ -64,12 +65,13 @@
6465
<label>@ResourceKey("Admin.autoremoveusers")</label>
6566
@CheckBox(info, "genxml/checkbox/autoremoveusers", "", "")
6667
</div>
67-
<div class="col-sm-3">
68+
<div class="col-sm-6">
6869
@if (DnnUtils.IsInRole("Administrator"))
6970
{
7071
<br />
7172
<label>DEBUG MODE</label>
72-
@CheckBox(info, "genxml/checkbox/debugmode", "", "")
73+
@CheckBox(info, "genxml/checkbox/debugmode", "", "")
74+
<b>&nbsp;IMPORTANT: Turn off for live site.</b>
7375
}
7476
</div>
7577
</div>

0 commit comments

Comments
 (0)