From cbd637b2a2a1379a7c381e6c54a9e49fded32363 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 22 Jun 2016 22:07:20 +0300 Subject: [PATCH] dont allow priv group names --- src/socket.io/admin/groups.js | 4 +++- src/socket.io/groups.js | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/socket.io/admin/groups.js b/src/socket.io/admin/groups.js index 206604ec8f..c912008210 100644 --- a/src/socket.io/admin/groups.js +++ b/src/socket.io/admin/groups.js @@ -5,8 +5,10 @@ var groups = require('../../groups'), Groups = {}; Groups.create = function(socket, data, callback) { - if(!data) { + if (!data) { return callback(new Error('[[error:invalid-data]]')); + } else if (groups.isPrivilegeGroup(data.name)) { + return callback(new Error('[[error:invalid-group-name]]')); } groups.create({ diff --git a/src/socket.io/groups.js b/src/socket.io/groups.js index a54db76b05..4e48a9649b 100644 --- a/src/socket.io/groups.js +++ b/src/socket.io/groups.js @@ -170,6 +170,8 @@ SocketGroups.create = function(socket, data, callback) { return callback(new Error('[[error:no-privileges]]')); } else if (parseInt(meta.config.allowGroupCreation, 10) !== 1) { return callback(new Error('[[error:group-creation-disabled]]')); + } else if (groups.isPrivilegeGroup(data.name)) { + return callback(new Error('[[error:invalid-group-name]]')); }