|
|
@@ -350,18 +350,18 @@ module.exports = app => {
|
|
|
const exist = await this.getAllDataByCondition({ columns: ['uid'], where: { spid } });
|
|
|
copyPermission.forEach(cp => {
|
|
|
const ecp = exist.find(x => { return x.uid === cp.uid; });
|
|
|
- if (ecp && force) {
|
|
|
- const udata = { id: ecp.id };
|
|
|
- for (const prop in cp) {
|
|
|
- if (prop.indexOf('_permission') > 1) udata[prop] = cp[prop];
|
|
|
- }
|
|
|
- updateData.push(udata)
|
|
|
- } else {
|
|
|
+ if (!ecp) {
|
|
|
const idata = { id: this.uuid.v4(), spid, pid: cp.pid, uid: cp.uid };
|
|
|
for (const prop in cp) {
|
|
|
if (prop.indexOf('_permission') > 1) idata[prop] = cp[prop];
|
|
|
}
|
|
|
insertData.push(idata);
|
|
|
+ } else if (force) {
|
|
|
+ const udata = { id: ecp.id };
|
|
|
+ for (const prop in cp) {
|
|
|
+ if (prop.indexOf('_permission') > 1) udata[prop] = cp[prop];
|
|
|
+ }
|
|
|
+ updateData.push(udata);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -374,7 +374,7 @@ module.exports = app => {
|
|
|
if (data.add) result.add = await this._addUser(subProject, data.add);
|
|
|
if (data.del) result.del = await this._delUser(subProject, data.del);
|
|
|
if (data.update) result.update = await this._updateUserPermission(data.update);
|
|
|
- if (data.copy) await this._copyUserPermission(data.copy);
|
|
|
+ if (data.copy) await this._copyUserPermission(data.copy, data.existType === 'cover');
|
|
|
return result;
|
|
|
}
|
|
|
|