From 05411651b3bdd7bbe373e99a4f9a569fa6b9212f Mon Sep 17 00:00:00 2001 From: barisusakli Date: Tue, 28 Jul 2015 13:26:52 -0400 Subject: [PATCH] server side check so you can't leave admin group --- src/socket.io/groups.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/socket.io/groups.js b/src/socket.io/groups.js index 6f2d364b0a..7ee8d59b0b 100644 --- a/src/socket.io/groups.js +++ b/src/socket.io/groups.js @@ -43,6 +43,10 @@ SocketGroups.leave = function(socket, data, callback) { return callback(new Error('[[error:invalid-uid]]')); } + if (data.groupName === 'administrators') { + return callback(new Error('[[error:cant-remove-self-as-admin]]')); + } + groups.leave(data.groupName, socket.uid, callback); }; @@ -131,7 +135,7 @@ function acceptRejectAll(type, socket, data, callback) { } ], callback); }); -}; +} SocketGroups.issueInvite = function(socket, data, callback) { if (!data) {