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:convertProfileImageToPNG": 0,
"profile:keepAllUserImages": 0, "profile:keepAllUserImages": 0,
"requireEmailConfirmation": 0, "requireEmailConfirmation": 0,
"gdpr_enabled": 1,
"allowProfileImageUploads": 1, "allowProfileImageUploads": 1,
"teaserPost": "last-reply", "teaserPost": "last-reply",
"allowPrivateGroups": 1, "allowPrivateGroups": 1,

@ -8,6 +8,8 @@
"allow-login-with.username": "Username Only", "allow-login-with.username": "Username Only",
"allow-login-with.email": "Email Only", "allow-login-with.email": "Email Only",
"account-settings": "Account Settings", "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-username-changes": "Disable username changes",
"disable-email-changes": "Disable email changes", "disable-email-changes": "Disable email changes",
"disable-password-changes": "Disable password changes", "disable-password-changes": "Disable password changes",

@ -10,6 +10,11 @@ var accountHelpers = require('./helpers');
var consentController = module.exports; var consentController = module.exports;
consentController.get = function (req, res, next) { consentController.get = function (req, res, next) {
if (!meta.config.gdpr_enabled) {
// GDPR disabled
return next();
}
var userData; var userData;
async.waterfall([ async.waterfall([

@ -51,32 +51,32 @@ helpers.getUserDataByUserSlug = function (userslug, callerUID, callback) {
user.getIPs(uid, 4, next); user.getIPs(uid, 4, next);
}, },
profile_menu: function (next) { profile_menu: function (next) {
plugins.fireHook('filter:user.profileMenu', { const links = [{
uid: uid, id: 'info',
callerUID: callerUID, route: 'info',
links: [{ name: '[[user:account_info]]',
id: 'info', visibility: {
route: 'info', self: false,
name: '[[user:account_info]]', other: false,
visibility: { moderator: true,
self: false, globalMod: true,
other: false, admin: true,
moderator: true, },
globalMod: true, }, {
admin: true, id: 'sessions',
}, route: 'sessions',
}, { name: '[[pages:account/sessions]]',
id: 'sessions', visibility: {
route: 'sessions', self: true,
name: '[[pages:account/sessions]]', other: false,
visibility: { moderator: false,
self: true, globalMod: false,
other: false, admin: false,
moderator: false, },
globalMod: false, }];
admin: false,
}, if (meta.config.gdpr_enabled) {
}, { links.push({
id: 'consent', id: 'consent',
route: 'consent', route: 'consent',
name: '[[user:consent.title]]', name: '[[user:consent.title]]',
@ -87,7 +87,13 @@ helpers.getUserDataByUserSlug = function (userslug, callerUID, callback) {
globalMod: false, globalMod: false,
admin: false, admin: false,
}, },
}], });
}
plugins.fireHook('filter:user.profileMenu', {
uid: uid,
callerUID: callerUID,
links: links,
}, next); }, next);
}, },
groups: function (next) { groups: function (next) {

@ -345,6 +345,10 @@ User.addInterstitials = function (callback) {
method: [ method: [
// GDPR information collection/processing consent + email consent // GDPR information collection/processing consent + email consent
function (data, callback) { function (data, callback) {
if (!meta.config.gdpr_enabled) {
return setImmediate(callback, null, data);
}
const add = function () { const add = function () {
data.interstitials.push({ data.interstitials.push({
template: 'partials/gdpr_consent', 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-2 col-xs-12 settings-header">[[admin/settings/user:account-settings]]</div>
<div class="col-sm-10 col-xs-12"> <div class="col-sm-10 col-xs-12">
<form> <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"> <div class="checkbox">
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect"> <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
<input class="mdl-switch__input" type="checkbox" data-field="username:disableEdit"> <input class="mdl-switch__input" type="checkbox" data-field="username:disableEdit">

Loading…
Cancel
Save