mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
closes #721, admins can edit other users from their edit page
This commit is contained in:
@@ -80,9 +80,24 @@ SocketUser.changePassword = function(socket, data, callback) {
|
||||
};
|
||||
|
||||
SocketUser.updateProfile = function(socket, data, callback) {
|
||||
if(data) {
|
||||
user.updateProfile(socket.uid, data, callback);
|
||||
if(!data || !data.uid) {
|
||||
return callback(new Error('invalid-data'));
|
||||
}
|
||||
|
||||
if(socket.uid === parseInt(data.uid, 10)) {
|
||||
return user.updateProfile(socket.uid, data, callback);
|
||||
}
|
||||
|
||||
user.isAdministrator(socket.uid, function(err, isAdmin) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
if(!isAdmin) {
|
||||
return callback(new Error('not allowed!'))
|
||||
}
|
||||
|
||||
user.updateProfile(data.uid, data, callback);
|
||||
});
|
||||
};
|
||||
|
||||
SocketUser.changePicture = function(socket, data, callback) {
|
||||
|
||||
Reference in New Issue
Block a user