@steedos/standard-permission 2.5.3-beta.9 → 2.5.5-beta.1

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.
@@ -108,9 +108,9 @@ listviews:
108
108
  all:
109
109
  label: All
110
110
  permission_set:
111
- label: Permission Set
111
+ label: Permission Sets
112
112
  profile:
113
- label: Profile
113
+ label: Profiles
114
114
  actions:
115
115
  customize:
116
116
  label: Customize
@@ -1,7 +1,9 @@
1
1
  module.exports = {
2
2
  customize: function (object_name, record_id, fields) {
3
3
  var doc = Creator.odata.get(object_name, record_id)
4
- Creator.odata.insert(object_name, {name: doc.name, label: doc.label, type: doc.type, license: doc.license, lockout_interval: doc.lockout_interval, max_login_attempts: doc.max_login_attempts, password_history: doc.password_history}, function(result, error){
4
+ Creator.odata.insert(object_name, {name: doc.name, label: doc.label, type: doc.type, license: doc.license, lockout_interval: doc.lockout_interval, max_login_attempts: doc.max_login_attempts, password_history: doc.password_history,
5
+ default_standard_buttons: doc.default_standard_buttons
6
+ }, function(result, error){
5
7
  if(result){
6
8
  FlowRouter.go(`/app/-/${object_name}/view/${result._id}`)
7
9
  }
@@ -24,7 +24,7 @@ fields:
24
24
  label: Type
25
25
  type: select
26
26
  firstOption: false
27
- options: Profile:profile,Permission set:permission_set
27
+ options: Permission set:permission_set
28
28
  defaultValue: permission_set
29
29
  assigned_apps:
30
30
  label: Assigned Apps
@@ -9,6 +9,6 @@ allowRead: true
9
9
  allowReadFiles: true
10
10
  modifyAllRecords: false
11
11
  permission_set_id: customer
12
- viewAllFiles: false
13
- viewAllRecords: false
14
- viewCompanyRecords: false
12
+ viewAllFiles: true
13
+ viewAllRecords: true
14
+ viewCompanyRecords: true
@@ -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-05-13 17:00:38
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
 
@@ -228,7 +228,7 @@ async function getInternalPermissionObjects(permissionSetId) {
228
228
  filters: [
229
229
  ['_id', '=', permissionSetId],
230
230
  ]
231
- })[0]);
231
+ }))[0];
232
232
  // 如果库中有记录则使用库中的name作为判断条件,否则使用permissionSetId
233
233
  const permissionSetName = permissionSetDoc ? permissionSetDoc.name : permissionSetId;
234
234
 
@@ -105,7 +105,7 @@ module.exports = {
105
105
  filters: [
106
106
  ['_id', '=', permissionSetId],
107
107
  ]
108
- })[0]);
108
+ }))[0];
109
109
  if (permissionSetDoc) {
110
110
  // 替换this.query.filters中全部的的permission_set_id为permissionSetDoc.name
111
111
  this.query.filters = this.query.filters.replace(regex, permissionSetDoc.name).replace(`permission_set_id eq '${permissionSetDoc.name}'`, `(permission_set_id eq '${permissionSetDoc.name}') or (permission_set_id eq '${permissionSetId}')`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-permission",
3
- "version": "2.5.3-beta.9",
3
+ "version": "2.5.5-beta.1",
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": "94bb5ef26fa3d0504e3131d2f9d990d4545430a3"
15
+ "gitHead": "2d9b97fbe49148c4440eaf3d127e3344f10caede"
16
16
  }