mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-31 19:15:58 +01:00
update groups join to take array of group names (#6834)
* allow groups.join to take an array of group names * pass an array to groups.join/leave in privileges * split up groups/membership * add hits/miss to group cache * fix typo
This commit is contained in:
committed by
GitHub
parent
523d68c640
commit
b57db7fd8e
@@ -227,8 +227,16 @@ helpers.getGroupPrivileges = function (cid, hookName, groupPrivilegeList, callba
|
||||
], callback);
|
||||
};
|
||||
|
||||
helpers.giveOrRescind = function (method, privileges, cid, groupName, callback) {
|
||||
async.eachSeries(privileges, function (privilege, next) {
|
||||
method('cid:' + cid + ':privileges:groups:' + privilege, groupName, next);
|
||||
helpers.giveOrRescind = function (method, privileges, cids, groupNames, callback) {
|
||||
groupNames = Array.isArray(groupNames) ? groupNames : [groupNames];
|
||||
cids = Array.isArray(cids) ? cids : [cids];
|
||||
async.eachSeries(groupNames, function (groupName, next) {
|
||||
var groupKeys = [];
|
||||
cids.forEach((cid) => {
|
||||
privileges.forEach((privilege) => {
|
||||
groupKeys.push('cid:' + cid + ':privileges:groups:' + privilege);
|
||||
});
|
||||
});
|
||||
method(groupKeys, groupName, next);
|
||||
}, callback);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user