diff --git a/src/socket.io/user.js b/src/socket.io/user.js index 4f16e82eda..071cb6a5f7 100644 --- a/src/socket.io/user.js +++ b/src/socket.io/user.js @@ -353,3 +353,16 @@ SocketUser.gdpr = {}; SocketUser.gdpr.consent = function (socket, data, callback) { user.setUserField(socket.uid, 'gdpr_consent', 1, callback); }; + +SocketUser.gdpr.check = function (socket, data, callback) { + async.waterfall([ + async.apply(user.isAdministrator, socket.uid), + function (isAdmin, next) { + if (!isAdmin) { + data.uid = socket.uid; + } + + db.getObjectField('user:' + data.uid, 'gdpr_consent', next); + }, + ], callback); +};