add `filter:categories.copyPrivilegesFrom`

https://github.com/Schamper/nodebb-plugin-poll/issues/77
v1.18.x
barisusakli 8 years ago
parent 65cf2dbe55
commit 8f0f959d53

@ -139,9 +139,20 @@ module.exports = function (Categories) {
};
Categories.copyPrivilegesFrom = function (fromCid, toCid, callback) {
async.each(privileges.privilegeList, function (privilege, next) {
copyPrivilege(privilege, fromCid, toCid, next);
}, callback);
async.waterfall([
function (next) {
plugins.fireHook('filter:categories.copyPrivilegesFrom', {
privileges: privileges.privilegeList,
fromCid: fromCid,
toCid: toCid
}, next);
},
function (data, next) {
async.each(data.privileges, function (privilege, next) {
copyPrivilege(privilege, data.fromCid, data.toCid, next);
}, next);
}
], callback);
};
function copyPrivilege(privilege, fromCid, toCid, callback) {

Loading…
Cancel
Save