Skip to content

Node.js based forum software built for the modern web

feat: allow disabling of GDPR features via ACP toggle, closes #6847

Julian Lam4919e9efa368
diff --git a/install/data/defaults.json b/install/data/defaults.json
index beacb2f00d..d08ad93763 100644
--- a/install/data/defaults.json
+++ b/install/data/defaults.json
@@ -55,6 +55,7 @@
"profile:convertProfileImageToPNG": 0,
"profile:keepAllUserImages": 0,
"requireEmailConfirmation": 0,
+ "gdpr_enabled": 1,
"allowProfileImageUploads": 1,
"teaserPost": "last-reply",
"allowPrivateGroups": 1,
diff --git a/public/language/en-GB/admin/settings/user.json b/public/language/en-GB/admin/settings/user.json
index 99b6e05a58..501441aa64 100644
--- a/public/language/en-GB/admin/settings/user.json
+++ b/public/language/en-GB/admin/settings/user.json
@@ -8,6 +8,8 @@
"allow-login-with.username": "Username Only",
"allow-login-with.email": "Email Only",
"account-settings": "Account Settings",
+ "gdpr_enabled": "Enable GDPR consent collection",
+ "gdpr_enabled_help": "When enabled, all new registrants will be required to explicitly give consent for data collection and usage under the <a href=\"https://eugdpr.org/the-regulation/gdpr-faqs/\">General Data Protection Regulation (GDPR)</a>. <strong>Note</strong>: Enabling GDPR does not force pre-existing users to provide consent. To do so, you will need to install the GDPR plugin.",
"disable-username-changes": "Disable username changes",
"disable-email-changes": "Disable email changes",
"disable-password-changes": "Disable password changes",
diff --git a/src/controllers/accounts/consent.js b/src/controllers/accounts/consent.js
index 0ea9e7e47c..aca8b26df0 100644
--- a/src/controllers/accounts/consent.js
+++ b/src/controllers/accounts/consent.js
@@ -10,6 +10,11 @@ var accountHelpers = require('./helpers');
var consentController = module.exports;
consentController.get = function (req, res, next) {
+ if (!meta.config.gdpr_enabled) {
+ // GDPR disabled
+ return next();
+ }
+
var userData;
async.waterfall([
diff --git a/src/controllers/accounts/helpers.js b/src/controllers/accounts/helpers.js
index b42f21c2b6..a0ecfcfe1c 100644
--- a/src/controllers/accounts/helpers.js
+++ b/src/controllers/accounts/helpers.js
@@ -51,32 +51,32 @@ helpers.getUserDataByUserSlug = function (userslug, callerUID, callback) {
user.getIPs(uid, 4, next);
},
profile_menu: function (next) {
- plugins.fireHook('filter:user.profileMenu', {
- uid: uid,
- callerUID: callerUID,
- links: [{
- id: 'info',
- route: 'info',
- name: '[[user:account_info]]',
- visibility: {
- self: false,
- other: false,
- moderator: true,
- globalMod: true,
- admin: true,
- },
- }, {
- id: 'sessions',
- route: 'sessions',
- name: '[[pages:account/sessions]]',
- visibility: {
- self: true,
- other: false,
- moderator: false,
- globalMod: false,
- admin: false,
- },
- }, {
+ const links = [{
+ id: 'info',
+ route: 'info',
+ name: '[[user:account_info]]',
+ visibility: {
+ self: false,
+ other: false,
+ moderator: true,
+ globalMod: true,
+ admin: true,
+ },
+ }, {
+ id: 'sessions',
+ route: 'sessions',
+ name: '[[pages:account/sessions]]',
+ visibility: {
+ self: true,
+ other: false,
+ moderator: false,
+ globalMod: false,
+ admin: false,
+ },
+ }];
+
+ if (meta.config.gdpr_enabled) {
+ links.push({
id: 'consent',
route: 'consent',
name: '[[user:consent.title]]',
@@ -87,7 +87,13 @@ helpers.getUserDataByUserSlug = function (userslug, callerUID, callback) {
globalMod: false,
admin: false,
},
- }],
+ });
+ }
+
+ plugins.fireHook('filter:user.profileMenu', {
+ uid: uid,
+ callerUID: callerUID,
+ links: links,
}, next);
},
groups: function (next) {
diff --git a/src/user/index.js b/src/user/index.js
index d78184f8bb..d3fc8cc85a 100644
--- a/src/user/index.js
+++ b/src/user/index.js
@@ -345,6 +345,10 @@ User.addInterstitials = function (callback) {
method: [
// GDPR information collection/processing consent + email consent
function (data, callback) {
+ if (!meta.config.gdpr_enabled) {
+ return setImmediate(callback, null, data);
+ }
+
const add = function () {
data.interstitials.push({
template: 'partials/gdpr_consent',
diff --git a/src/views/admin/settings/user.tpl b/src/views/admin/settings/user.tpl
index 415c516477..882f567cfb 100644
--- a/src/views/admin/settings/user.tpl
+++ b/src/views/admin/settings/user.tpl
@@ -34,6 +34,13 @@
<div class="col-sm-2 col-xs-12 settings-header">[[admin/settings/user:account-settings]]</div>
<div class="col-sm-10 col-xs-12">
<form>
+ <div class="checkbox">
+ <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
+ <input class="mdl-switch__input" type="checkbox" data-field="gdpr_enabled">
+ <span class="mdl-switch__label"><strong>[[admin/settings/user:gdpr_enabled]]</strong></span>
+ </label>
+ <p class="help-block">[[admin/settings/user:gdpr_enabled_help]]</p>
+ </div>
<div class="checkbox">
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
<input class="mdl-switch__input" type="checkbox" data-field="username:disableEdit">