fix privs

v1.18.x
barisusakli 9 years ago
parent 8f594de4c2
commit 09ce48ad33

@ -35,12 +35,12 @@ module.exports = function(privileges) {
}, next); }, next);
}, },
users: function(next) { users: function(next) {
var privs; var userPrivileges;
async.waterfall([ async.waterfall([
async.apply(plugins.fireHook, 'filter:privileges.list', privileges.userPrivilegeList), async.apply(plugins.fireHook, 'filter:privileges.list', privileges.userPrivilegeList),
function(_privs, next) { function(_privs, next) {
privs = _privs; userPrivileges = _privs;
groups.getMembersOfGroups(privs.map(function(privilege) { groups.getMembersOfGroups(userPrivileges.map(function(privilege) {
return 'cid:' + cid + ':privileges:' + privilege; return 'cid:' + cid + ':privileges:' + privilege;
}), next); }), next);
}, },
@ -61,8 +61,8 @@ module.exports = function(privileges) {
memberData.forEach(function(member) { memberData.forEach(function(member) {
member.privileges = {}; member.privileges = {};
for(var x=0,numPrivs=privileges.length;x<numPrivs;x++) { for(var x=0,numPrivs=userPrivileges.length;x<numPrivs;x++) {
member.privileges[privileges[x]] = memberSets[x].indexOf(parseInt(member.uid, 10)) !== -1; member.privileges[userPrivileges[x]] = memberSets[x].indexOf(parseInt(member.uid, 10)) !== -1;
} }
}); });
@ -72,12 +72,12 @@ module.exports = function(privileges) {
], next); ], next);
}, },
groups: function(next) { groups: function(next) {
var privs; var groupPrivileges;
async.waterfall([ async.waterfall([
async.apply(plugins.fireHook, 'filter:privileges.groups.list', privileges.groupPrivilegeList), async.apply(plugins.fireHook, 'filter:privileges.groups.list', privileges.groupPrivilegeList),
function(_privs, next) { function(_privs, next) {
privs = _privs; groupPrivileges = _privs;
groups.getMembersOfGroups(privs.map(function(privilege) { groups.getMembersOfGroups(groupPrivileges.map(function(privilege) {
return 'cid:' + cid + ':privileges:' + privilege; return 'cid:' + cid + ':privileges:' + privilege;
}), next); }), next);
}, },
@ -112,8 +112,8 @@ module.exports = function(privileges) {
var memberData = groupNames.map(function(member) { var memberData = groupNames.map(function(member) {
memberPrivs = {}; memberPrivs = {};
for(var x=0,numPrivs=privileges.length;x<numPrivs;x++) { for(var x=0,numPrivs=groupPrivileges.length;x<numPrivs;x++) {
memberPrivs[privileges[x]] = memberSets[x].indexOf(member) !== -1; memberPrivs[groupPrivileges[x]] = memberSets[x].indexOf(member) !== -1;
} }
return { return {
name: member, name: member,

Loading…
Cancel
Save