allowing array of privileges to be passed into setPrivilege in category admin socket listener

v1.18.x
Julian Lam 10 years ago
parent cbb0542984
commit cc2a92d73f

@ -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) {

Loading…
Cancel
Save