tweaks to category permission modal

This commit is contained in:
Julian Lam
2013-11-28 14:27:19 -05:00
parent e3e1a556cd
commit 38da65ee58
4 changed files with 50 additions and 32 deletions

View File

@@ -1011,23 +1011,32 @@ module.exports.init = function(io) {
socket.on('api:admin.categories.getPrivilegeSettings', function(cid, callback) {
async.parallel({
"+r": function(next) {
Groups.getByGroupName('cid:' + cid + ':privileges:+r', { expand: true }, next);
Groups.getByGroupName('cid:' + cid + ':privileges:+r', { expand: true }, function(err, groupObj) {
if (!err) {
next.apply(this, arguments);
} else {
next(null, {
members: []
});
}
});
},
"+w": function(next) {
Groups.getByGroupName('cid:' + cid + ':privileges:+w', { expand: true }, next);
Groups.getByGroupName('cid:' + cid + ':privileges:+w', { expand: true }, function(err, groupObj) {
if (!err) {
next.apply(this, arguments);
} else {
next(null, {
members: []
});
}
});
}
}, function(err, data) {
if (!err) {
callback(null, {
"+r": data['+r'].members,
"+w": data['+w'].members
});
} else {
callback(null, {
"+r": [],
"+w": []
});
}
callback(null, {
"+r": data['+r'].members,
"+w": data['+w'].members
});
});
});