From 21ad15b13a6012eaf00d04f3b701afb9176764ae Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 8 Jul 2015 12:20:07 -0400 Subject: [PATCH] closes #3306 --- src/socket.io/admin/groups.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/socket.io/admin/groups.js b/src/socket.io/admin/groups.js index ce3d86593b..347a26d33a 100644 --- a/src/socket.io/admin/groups.js +++ b/src/socket.io/admin/groups.js @@ -23,7 +23,7 @@ Groups.get = function(socket, groupName, callback) { }; Groups.join = function(socket, data, callback) { - if(!data) { + if (!data) { return callback(new Error('[[error:invalid-data]]')); } @@ -31,10 +31,14 @@ Groups.join = function(socket, data, callback) { }; Groups.leave = function(socket, data, callback) { - if(!data) { + if (!data) { return callback(new Error('[[error:invalid-data]]')); } + if (socket.uid === parseInt(data.uid, 10) && data.groupName === 'administrators') { + return callback(new Error('[[error:cant-remove-self-as-admin]]')); + } + groups.leave(data.groupName, data.uid, callback); };