From cc2a92d73ff16837feb0c4e427c7f831b39cfcd0 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 26 May 2015 11:52:34 -0400 Subject: [PATCH] allowing array of privileges to be passed into setPrivilege in category admin socket listener --- src/socket.io/admin/categories.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/socket.io/admin/categories.js b/src/socket.io/admin/categories.js index 4db4445d4d..848d175a09 100644 --- a/src/socket.io/admin/categories.js +++ b/src/socket.io/admin/categories.js @@ -59,7 +59,13 @@ Categories.setPrivilege = function(socket, data, callback) { return callback(new Error('[[error:invalid-data]]')); } - groups[data.set ? 'join' : 'leave']('cid:' + data.cid + ':privileges:' + data.privilege, data.member, callback); + if (Array.isArray(data.privilege)) { + async.each(data.privilege, function(privilege, next) { + groups[data.set ? 'join' : 'leave']('cid:' + data.cid + ':privileges:' + privilege, data.member, next); + }, callback); + } else { + groups[data.set ? 'join' : 'leave']('cid:' + data.cid + ':privileges:' + data.privilege, data.member, callback); + } }; Categories.getPrivilegeSettings = function(socket, cid, callback) {