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

v1.18.x
Julian Lam 6 years ago
parent 51792da430
commit 4919e9efa3

@ -55,6 +55,7 @@
"profile:convertProfileImageToPNG": 0,
"profile:keepAllUserImages": 0,
"requireEmailConfirmation": 0,
"gdpr_enabled": 1,
"allowProfileImageUploads": 1,
"teaserPost": "last-reply",
"allowPrivateGroups": 1,

@ -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",

@ -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([

@ -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) {

@ -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',

@ -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">

Loading…
Cancel
Save