|
@@ -11,7 +11,7 @@
|
|
|
const path = require('path');
|
|
|
|
|
|
module.exports = app => {
|
|
|
- class Filing extends app.BaseService {
|
|
|
+ class File extends app.BaseService {
|
|
|
|
|
|
/**
|
|
|
* 构造函数
|
|
@@ -82,7 +82,7 @@ module.exports = app => {
|
|
|
const filing = await this.ctx.service.filing.getDataById(fileDatas[0].filing_id);
|
|
|
if (this.ctx.subProject.permission.file_permission.indexOf(this.ctx.service.subProjPermission.PermissionConst.file.editfile.value) < 0) {
|
|
|
for (const file of fileDatas) {
|
|
|
- if (file.user_id !== this.ctx.session.sessionUser.accountId) throw '无权删除文件';
|
|
|
+ if (file.user_id !== this.ctx.session.sessionUser.accountId && ctx.subProject.permission.file_permission.indexOf(ctx.service.subProjPermission.PermissionConst.file.editfile.value) < 0) throw '无权删除文件';
|
|
|
}
|
|
|
}
|
|
|
const result = {};
|
|
@@ -132,7 +132,7 @@ module.exports = app => {
|
|
|
async saveFile(id, filename){
|
|
|
const file = await this.getDataById(id);
|
|
|
if (!file) throw '文件不存在';
|
|
|
- if (file.user_id !== this.ctx.session.sessionUser.accountId) throw '您无权编辑该文件';
|
|
|
+ if (file.user_id !== this.ctx.session.sessionUser.accountId && ctx.subProject.permission.file_permission.indexOf(ctx.service.subProjPermission.PermissionConst.file.editfile.value) < 0) throw '您无权编辑该文件';
|
|
|
|
|
|
const info = path.parse(filename);
|
|
|
const updateData = { id, filename: info.name, fileext: info.ext};
|
|
@@ -143,7 +143,7 @@ module.exports = app => {
|
|
|
async moveFile(id, filing_id) {
|
|
|
const file = await this.getDataById(id);
|
|
|
if (!file) throw '文件不存在';
|
|
|
- if (file.user_id !== this.ctx.session.sessionUser.accountId) throw '您无权编辑该文件';
|
|
|
+ if (file.user_id !== this.ctx.session.sessionUser.accountId && ctx.subProject.permission.file_permission.indexOf(ctx.service.subProjPermission.PermissionConst.file.editfile.value) < 0) throw '您无权编辑该文件';
|
|
|
const orgFiling = await this.ctx.service.filing.getDataById(file.filing_id);
|
|
|
const filing = await this.ctx.service.filing.getDataById(filing_id);
|
|
|
if (!filing) throw '目标分类不存在';
|
|
@@ -173,5 +173,5 @@ module.exports = app => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return Filing;
|
|
|
+ return File;
|
|
|
};
|