@steedos/standard-permission 2.5.7 → 2.5.8-beta.2

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.
@@ -5,7 +5,7 @@ amis_schema: |-
5
5
  "body": [
6
6
  {
7
7
  "type": "button",
8
- "label": "复制",
8
+ "label": "${'permission_set.copy.copy' | t}",
9
9
  "id": "u:copy",
10
10
  "onEvent": {
11
11
  "click": {
@@ -14,16 +14,16 @@ amis_schema: |-
14
14
  {
15
15
  "dialog": {
16
16
  "type": "dialog",
17
- "title": "复制 当前简档记录",
17
+ "title": "${'permission_set.copy.copy_record' | t}",
18
18
  "body": [
19
19
  {
20
20
  "type": "form",
21
21
  "title": "表单",
22
22
  "body": [
23
23
  {
24
- "label": "显示名称",
24
+ "label": "${'permission_set.copy.display_name' | t}",
25
25
  "type": "input-text",
26
- "value": "${record.label} 的副本",
26
+ "value": "${'permission_set.copy.copy_of_record' | t:${record.label}}",
27
27
  "name": "label_input",
28
28
  "id": "u:24e89a11d437",
29
29
  "required": true
@@ -32,7 +32,7 @@ amis_schema: |-
32
32
  "type": "input-text",
33
33
  "name": "name_input",
34
34
  "value": "${record.name}_copy",
35
- "label": "api名称",
35
+ "label": "${'permission_set.copy.api_name' | t}",
36
36
  "id": "u:27bd7cfe3e12",
37
37
  "required": true
38
38
  }
@@ -5,7 +5,7 @@ amis_schema: |-
5
5
  "body": [
6
6
  {
7
7
  "type": "button",
8
- "label": "设置选项卡权限",
8
+ "label": "${'permission_set.set_permission_tabs.set_permission' | t}",
9
9
  "id": "u:set_permission_tabs",
10
10
  "onEvent": {
11
11
  "click": {
@@ -14,7 +14,7 @@ amis_schema: |-
14
14
  "actionType": "dialog",
15
15
  "dialog": {
16
16
  "type": "dialog",
17
- "title": "设置选项卡权限",
17
+ "title": "${'permission_set.set_permission_tabs.set_permission' | t}",
18
18
  "body": [
19
19
  {
20
20
  "type": "form",
@@ -27,14 +27,14 @@ amis_schema: |-
27
27
  "label": "",
28
28
  "columns": [
29
29
  {
30
- "label": "选项卡",
30
+ "label": "${'permission_set.set_permission_tabs.tab' | t}",
31
31
  "name": "tab.label",
32
32
  "type": "text",
33
33
  "id": "u:ebd95b18057a",
34
34
  "placeholder": "-"
35
35
  },
36
36
  {
37
- "label": "权限",
37
+ "label": "${'permission_set.set_permission_tabs.permission' | t}",
38
38
  "name": "permission",
39
39
  "type": "select",
40
40
  "id": "u:ad5dcb76754f",
@@ -104,7 +104,7 @@ amis_schema: |-
104
104
  "actions": [
105
105
  {
106
106
  "type": "button",
107
- "label": "取消",
107
+ "label": "${'permission_set.set_permission_tabs.cancel' | t}",
108
108
  "onEvent": {
109
109
  "click": {
110
110
  "actions": [
@@ -121,7 +121,7 @@ amis_schema: |-
121
121
  },
122
122
  {
123
123
  "type": "submit",
124
- "label": "保存",
124
+ "label": "${'permission_set.set_permission_tabs.save' | t}",
125
125
  "onEvent": {},
126
126
  "id": "u:246398c1f14c",
127
127
  "level": "primary",
@@ -16,6 +16,7 @@ const core = require('@steedos/core');
16
16
  const objectql = require('@steedos/objectql');
17
17
  const InternalData = require('@steedos/standard-objects').internalData;
18
18
  const _ = require('underscore');
19
+ const { MongoClient } = require('mongodb');
19
20
 
20
21
  /**
21
22
  * body {
@@ -67,11 +68,11 @@ router.post('/api/permission/permission_set/copy', core.requireAuthentication, a
67
68
  }
68
69
 
69
70
  // 事务 https://www.mongodb.com/docs/v4.4/core/transactions-in-applications/#core-api
70
- const config = objectql.getSteedosConfig();
71
- let datasourceConfig = config.datasources['default'];
72
- const driver = new objectql.SteedosMongoDriver(datasourceConfig.connection);
73
- await driver.connect();
74
- const client = driver._client;
71
+ const client = new MongoClient(process.env.MONGO_URL, {
72
+ useNewUrlParser: true,
73
+ useUnifiedTopology: true,
74
+ });
75
+ await client.connect();
75
76
  const db = client.db();
76
77
 
77
78
  // Start a session.
@@ -108,7 +109,7 @@ router.post('/api/permission/permission_set/copy', core.requireAuthentication, a
108
109
  is_system: false,
109
110
  name,
110
111
  label,
111
- _id: driver._makeNewID(),
112
+ _id: await psObj._makeNewID(),
112
113
  copy_from: originalPermissionSetId,
113
114
  };
114
115
 
@@ -129,7 +130,7 @@ router.post('/api/permission/permission_set/copy', core.requireAuthentication, a
129
130
  // 遍历原有的对象权限
130
131
  for (const poDoc of originalPermissionObjects) {
131
132
  const fromId = poDoc._id;
132
- const newId = driver._makeNewID();
133
+ const newId = await psObj._makeNewID();
133
134
  // 由于 15.permission_objects.observe.object.js 中的 _change 函数中,调用了 permission_fields.resetFieldPermissions 方法,会阻塞redis查询,需要调整15.permission_objects.observe.object.js, 避免调用 resetFieldPermissions 方法
134
135
  const newPermissionObject = {
135
136
  ...poDoc,
@@ -154,7 +155,7 @@ router.post('/api/permission/permission_set/copy', core.requireAuthentication, a
154
155
  field: field.name,
155
156
  editable: fieldPermission ? fieldPermission.editable : getFieldDefaultEditable(field),
156
157
  readable: fieldPermission ? fieldPermission.readable : getFieldDefaultReadable(field),
157
- _id: driver._makeNewID(),
158
+ _id: await psObj._makeNewID(),
158
159
  copy_from: fieldPermission ? fieldPermission._id : `${originalPermissionSetName}.${newPermissionObject.object_name}.${field.name}`
159
160
  })
160
161
  }
@@ -165,7 +166,7 @@ router.post('/api/permission/permission_set/copy', core.requireAuthentication, a
165
166
  // 遍历原有的选项卡权限
166
167
  for (const ptDoc of originalPermissionTabs) {
167
168
  const fromId = ptDoc._id;
168
- const newId = driver._makeNewID();
169
+ const newId = await psObj._makeNewID();
169
170
  delete ptDoc.record_permissions;
170
171
  newPermissionTabs.push({
171
172
  ...ptDoc,
@@ -0,0 +1,16 @@
1
+ CustomLabels:
2
+ permission_set:
3
+ set_permission_tabs:
4
+ set_permission: Set Tab Permissions
5
+ tab: Tab
6
+ permission: Permission
7
+ default_on: Default On
8
+ default_off: Default Off
9
+ cancel: Cancel
10
+ save: Save
11
+ copy:
12
+ copy: Copy
13
+ copy_record: Copy the Current Profile Record
14
+ display_name: Display Name
15
+ copy_of_record: "Copy of %s"
16
+ api_name: API Name
@@ -0,0 +1,16 @@
1
+ CustomLabels:
2
+ permission_set:
3
+ set_permission_tabs:
4
+ set_permission: 设置选项卡权限
5
+ tab: 选项卡
6
+ permission: 权限
7
+ default_on: 默认打开
8
+ default_off: 默认关闭
9
+ cancel: 取消
10
+ save: 保存
11
+ copy:
12
+ copy: 复制
13
+ copy_record: 复制 当前简档记录
14
+ display_name: 显示名称
15
+ copy_of_record: "%s 的副本"
16
+ api_name: API名称
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-permission",
3
- "version": "2.5.7",
3
+ "version": "2.5.8-beta.2",
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": "6a8199c9046ec05c8e05fc7588789cd16b7092bb"
15
+ "gitHead": "d64d32507a636e9d0e403090c1b76934cca4ebb6"
16
16
  }