|
@@ -125,6 +125,11 @@ module.exports = app => {
|
|
|
x.budget_permission = x.budget_permission ? _.map(x.budget_permission.split(','), _.toInteger) : [];
|
|
|
x.file_permission = x.file_permission ? _.map(x.file_permission.split(','), _.toInteger) : [];
|
|
|
x.manage_permission = x.manage_permission ? _.map(x.manage_permission.split(','), _.toInteger) : [];
|
|
|
+ x.info_permission = x.info_permission ? _.map(x.info_permission.split(','), _.toInteger) : [];
|
|
|
+ x.datacollect_permission = x.datacollect_permission ? _.map(x.datacollect_permission.split(','), _.toInteger) : [];
|
|
|
+ x.contract_permission = x.contract_permission ? _.map(x.contract_permission.split(','), _.toInteger) : [];
|
|
|
+ x.fund_pay_permission = x.fund_pay_permission ? _.map(x.fund_pay_permission.split(','), _.toInteger) : [];
|
|
|
+ x.fund_trans_permission = x.fund_trans_permission ? _.map(x.fund_trans_permission.split(','), _.toInteger) : [];
|
|
|
x.filing_type = x.filing_type ? _.map(x.filing_type.split(','), _.toInteger): [];
|
|
|
});
|
|
|
}
|
|
@@ -276,6 +281,23 @@ module.exports = app => {
|
|
|
});
|
|
|
if (updateData.length > 0) await this.db.updateRows(this.tableName, updateData);
|
|
|
}
|
|
|
+
|
|
|
+ checkViewPermission(ctx) {
|
|
|
+ const permissionBlock = ctx.service.subProjPermission.PermissionBlock.find(x => { return x.key === ctx.controllerName; });
|
|
|
+ if (!permissionBlock) return true;
|
|
|
+ if (permissionBlock.children) {
|
|
|
+ let canView = false;
|
|
|
+ for (const c of permissionBlock.children) {
|
|
|
+ const viewPermission = permissionBlock.permission.find(x => { return x.key === 'view'; });
|
|
|
+ if (!viewPermission || ctx.subProject.permission[c.field].indexOf(viewPermission.value) >= 0) canView = true;
|
|
|
+ }
|
|
|
+ return canView;
|
|
|
+ } else {
|
|
|
+ const viewPermission = permissionBlock.permission.find(x => { return x.key === 'view'; });
|
|
|
+ if (!viewPermission) return true;
|
|
|
+ return ctx.subProject.permission[permissionBlock.field].indexOf(viewPermission.value) >= 0;
|
|
|
+ }
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
return subProjPermission;
|