@steedos/standard-permission 2.5.3-beta.23 → 2.5.3-beta.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  * @Author: sunhaolin@hotoa.com
3
3
  * @Date: 2022-05-26 16:56:54
4
4
  * @LastEditors: sunhaolin@hotoa.com
5
- * @LastEditTime: 2023-06-14 10:49:23
5
+ * @LastEditTime: 2023-06-18 12:55:43
6
6
  * @Description: 复制已有简档来创建新简档
7
7
  * 使用mongodb的事务处理,保证数据的一致性
8
8
  * 复制对象包括:简档、对象权限、字段权限、选项卡权限
@@ -53,7 +53,7 @@ router.post('/api/permission/permission_set/copy', core.requireAuthentication, a
53
53
  throw new Error("permission_set is not profile type");
54
54
  }
55
55
 
56
- const { name:originalPermissionSetName } = originalPermissionSet;
56
+ const { name: originalPermissionSetName } = originalPermissionSet;
57
57
 
58
58
  // API名称不能重复
59
59
  const existPermissionSetCount = await psObj.count({
@@ -83,7 +83,7 @@ router.post('/api/permission/permission_set/copy', core.requireAuthentication, a
83
83
  const permissionSetColl = db.collection('permission_set');
84
84
 
85
85
  // Start a transaction
86
- session.startTransaction({ readConcern: { level: "local" }, writeConcern: { w: "majority" } });
86
+ session.startTransaction({ readConcern: { level: "majority" }, writeConcern: { w: "majority" }, readPreference: 'primary' });
87
87
 
88
88
  let newPermissionSet = null;
89
89
 
@@ -113,7 +113,7 @@ router.post('/api/permission/permission_set/copy', core.requireAuthentication, a
113
113
  };
114
114
 
115
115
  delete newPermissionSetData.record_permissions;
116
- const insertPermissionSetResult = await permissionSetColl.insertOne(newPermissionSetData);
116
+ const insertPermissionSetResult = await permissionSetColl.insertOne(newPermissionSetData, { session });
117
117
  newPermissionSet = insertPermissionSetResult.ops[0];
118
118
  // console.log('newPermissionSet', newPermissionSet)
119
119
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-permission",
3
- "version": "2.5.3-beta.23",
3
+ "version": "2.5.3-beta.26",
4
4
  "main": "package.service.js",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -12,5 +12,5 @@
12
12
  "description": "steedos package",
13
13
  "repository": {},
14
14
  "license": "MIT",
15
- "gitHead": "8fd9cf35d29f8f71e11790bd010bf5b045e7ebc4"
15
+ "gitHead": "4a93161d2d00ecd33e7e63fe478980bc6b1fb75b"
16
16
  }