Skip to content
This repository has been archived by the owner on Oct 6, 2019. It is now read-only.

Commit

Permalink
Data Consent feature for DNN (#717)
Browse files Browse the repository at this point in the history
* Add new settings to SiteSettings API

* Fix tab handling

* UI for new GDPR privacy settings

* Change terms reset from switch to button

* Improve gdpr settings UI

* Replace GDPR with DataConsent in code to avoid confusion

* Add user hard delete delay settings to UI

* New user deletion mechanisms and removal of anonymization

* update references to v9.4.0-PullRequest2683-0027
  • Loading branch information
donker authored and ohine committed Apr 12, 2019
1 parent 7e36f7b commit c929a85
Show file tree
Hide file tree
Showing 12 changed files with 793 additions and 283 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,42 @@ private void SerializePortalSettings(XmlWriter writer, PortalInfo portal, bool i
writer.WriteElementString("cookiemorelink", setting);
}

settingsDictionary.TryGetValue("DataConsentActive", out setting);
if (!string.IsNullOrEmpty(setting))
{
writer.WriteElementString("dataconsentactive", setting);
}

settingsDictionary.TryGetValue("DataConsentTermsLastChange", out setting);
if (!string.IsNullOrEmpty(setting))
{
writer.WriteElementString("dataconsenttermslastchange", setting);
}

settingsDictionary.TryGetValue("DataConsentConsentRedirect", out setting);
if (!string.IsNullOrEmpty(setting))
{
writer.WriteElementString("dataconsentconsentredirect", setting);
}

settingsDictionary.TryGetValue("DataConsentUserDeleteAction", out setting);
if (!string.IsNullOrEmpty(setting))
{
writer.WriteElementString("dataconsentuserdeleteaction", setting);
}

settingsDictionary.TryGetValue("DataConsentDelay", out setting);
if (!string.IsNullOrEmpty(setting))
{
writer.WriteElementString("dataconsentdelay", setting);
}

settingsDictionary.TryGetValue("DataConsentDelayMeasurement", out setting);
if (!string.IsNullOrEmpty(setting))
{
writer.WriteElementString("dataconsentdelaymeasurement", setting);
}

//End Portal Settings
writer.WriteEndElement();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand All @@ -84,6 +85,10 @@
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\bin\System.Web.Http.dll</HintPath>
Expand All @@ -93,6 +98,7 @@
<HintPath>..\..\..\bin\System.Web.Http.WebHost.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\SolutionInfo.cs">
Expand All @@ -109,6 +115,7 @@
<Compile Include="Services\Dto\LanguageTabDto.cs" />
<Compile Include="Services\Dto\LocalizationEntry.cs" />
<Compile Include="Services\Dto\LocalizationProgress.cs" />
<Compile Include="Services\Dto\ResetTermsAgreementRequest.cs" />
<Compile Include="Services\Dto\UpdateLanguageRequest.cs" />
<Compile Include="Services\Dto\UpdateLanguageSettingsRequest.cs" />
<Compile Include="Services\Dto\UpdateIgnoreWordsRequest.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#region Copyright
//
// DotNetNuke® - http://www.dotnetnuke.com
// Copyright (c) 2002-2018
// by DotNetNuke Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions
// of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion

namespace Dnn.PersonaBar.SiteSettings.Services.Dto
{
public class ResetTermsAgreementRequest
{
public int? PortalId { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,15 @@ public class UpdatePrivacySettingsRequest
public bool DnnImprovementProgram { get; set; }

public bool DisplayCopyright { get; set; }

public bool DataConsentActive { get; set; }

public int DataConsentConsentRedirect { get; set; }

public int DataConsentUserDeleteAction { get; set; }

public int DataConsentDelay { get; set; }

public string DataConsentDelayMeasurement { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,14 @@ public HttpResponseMessage GetPrivacySettings(int? portalId)
portalSettings.CookieMoreLink,
CheckUpgrade = HostController.Instance.GetBoolean("CheckUpgrade", true),
DnnImprovementProgram = HostController.Instance.GetBoolean("DnnImprovementProgram", true),
DisplayCopyright = HostController.Instance.GetBoolean("Copyright", true)
DisplayCopyright = HostController.Instance.GetBoolean("Copyright", true),
portalSettings.DataConsentActive,
DataConsentResetTerms = false,
DataConsentConsentRedirect = TabSanitizer(portalSettings.DataConsentConsentRedirect, pid)?.TabID,
DataConsentConsentRedirectName = TabSanitizer(portalSettings.DataConsentConsentRedirect, pid)?.TabName,
DataConsentUserDeleteAction = (int)portalSettings.DataConsentUserDeleteAction,
PortalSettings.DataConsentDelay,
PortalSettings.DataConsentDelayMeasurement
}
});
}
Expand Down Expand Up @@ -1611,6 +1618,11 @@ public HttpResponseMessage UpdatePrivacySettings(UpdatePrivacySettingsRequest re
HostController.Instance.Update("CheckUpgrade", request.CheckUpgrade ? "Y" : "N", false);
HostController.Instance.Update("DnnImprovementProgram", request.DnnImprovementProgram ? "Y" : "N", false);
HostController.Instance.Update("Copyright", request.DisplayCopyright ? "Y" : "N", false);
PortalController.UpdatePortalSetting(pid, "DataConsentActive", request.DataConsentActive.ToString(), false);
PortalController.UpdatePortalSetting(pid, "DataConsentConsentRedirect", ValidateTabId(request.DataConsentConsentRedirect, pid).ToString(), false);
PortalController.UpdatePortalSetting(pid, "DataConsentUserDeleteAction", request.DataConsentUserDeleteAction.ToString(), false);
PortalController.UpdatePortalSetting(pid, "DataConsentDelay", request.DataConsentDelay.ToString(), false);
PortalController.UpdatePortalSetting(pid, "DataConsentDelayMeasurement", request.DataConsentDelayMeasurement, false);
DataCache.ClearCache();

return Request.CreateResponse(HttpStatusCode.OK, new { Success = true });
Expand All @@ -1622,6 +1634,35 @@ public HttpResponseMessage UpdatePrivacySettings(UpdatePrivacySettingsRequest re
}
}

/// POST: api/SiteSettings/ResetTermsAgreement
/// <summary>
/// Resets terms and conditions agreements
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[ValidateAntiForgeryToken]
[DnnAuthorize(StaticRoles = Constants.AdminsRoleName)]
public HttpResponseMessage ResetTermsAgreement(ResetTermsAgreementRequest request)
{
try
{
var pid = request.PortalId ?? PortalId;
if (!UserInfo.IsSuperUser && PortalId != pid)
{
return Request.CreateErrorResponse(HttpStatusCode.Unauthorized, AuthFailureMessage);
}
UserController.ResetTermsAgreement(pid);
PortalController.UpdatePortalSetting(pid, "DataConsentTermsLastChange", DateTime.Now.ToString("u"), true);
return Request.CreateResponse(HttpStatusCode.OK, new { Success = true });
}
catch (Exception exc)
{
Logger.Error(exc);
return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc);
}
}

#endregion

#region Search Settings API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,17 @@ const siteBehaviorActions = {
});
};
},
resetTermsAgreement(payload, callback, failureCallback) {
ApplicationService.resetTermsAgreement(payload, data => {
if (callback) {
callback(data);
}
}, data => {
if (failureCallback) {
failureCallback(data);
}
});
},
privacySettingsClientModified(parameter) {
return (dispatch) => {
dispatch({
Expand Down
Loading

0 comments on commit c929a85

Please sign in to comment.