Skip to content

Node.js based forum software built for the modern web

Let global mods change user avatar

pichaliteab797b91a43e
diff --git a/src/socket.io/user/picture.js b/src/socket.io/user/picture.js
index 82404f1fe5..eacc5197aa 100644
--- a/src/socket.io/user/picture.js
+++ b/src/socket.io/user/picture.js
@@ -23,7 +23,7 @@ module.exports = function (SocketUser) {
async.waterfall([
function (next) {
- user.isAdminOrSelf(socket.uid, data.uid, next);
+ user.isAdminOrGlobalModOrSelf(socket.uid, data.uid, next);
},
function (next) {
switch(type) {
diff --git a/src/user.js b/src/user.js
index 7c0fa5e67e..00e5824690 100644
--- a/src/user.js
+++ b/src/user.js
@@ -276,6 +276,18 @@ var meta = require('./meta');
callback();
});
};
+
+ User.isAdminOrGlobalModOrSelf = function (callerUid, uid, callback) {
+ if (parseInt(callerUid, 10) === parseInt(uid, 10)) {
+ return callback();
+ }
+ User.isAdminOrGlobalMod(callerUid, function (err, isAdminOrGlobalMod) {
+ if (err || !isAdminOrGlobalMod) {
+ return callback(err || new Error('[[error:no-privileges]]'));
+ }
+ callback();
+ });
+ };
User.getAdminsandGlobalMods = function (callback) {
async.parallel({