mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-05 23:30:36 +01:00
add filter:categories.copyPrivilegesFrom
https://github.com/Schamper/nodebb-plugin-poll/issues/77
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user