|
|
|
@ -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) {
|
|
|
|
|