prevent administrators from being deleted - first remove them from admin group

v1.18.x
psychobunny 10 years ago
parent 45a0d0196b
commit 48c123592e

@ -98,15 +98,21 @@ User.deleteUsers = function(socket, uids, callback) {
}
async.each(uids, function(uid, next) {
user.delete(uid, function(err) {
if (err) {
return next(err);
user.isAdministrator(uid, function(err, isAdmin) {
if (err || isAdmin) {
return callback(err || new Error('[[error:cant-ban-other-admins]]'));
}
events.logAdminUserDelete(socket.uid, uid);
user.delete(uid, function(err) {
if (err) {
return next(err);
}
events.logAdminUserDelete(socket.uid, uid);
websockets.logoutUser(uid);
next();
websockets.logoutUser(uid);
next();
});
});
}, callback);
};

Loading…
Cancel
Save