@steedos/standard-permission 2.7.1-beta.3 → 2.7.1-beta.31

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.
@@ -6,6 +6,8 @@ fields:
6
6
  label: Name
7
7
  help:
8
8
  description:
9
+ allowEdit:
10
+ label: Allow Edit
9
11
  object_name:
10
12
  label: Object
11
13
  help:
@@ -6,6 +6,8 @@ fields:
6
6
  label: 名称
7
7
  help:
8
8
  description:
9
+ allowEdit:
10
+ label: 允许编辑
9
11
  object_name:
10
12
  label: 对象
11
13
  help:
@@ -21,10 +21,12 @@ fields:
21
21
  index: true
22
22
  is_name: true
23
23
  required: true
24
+ filterable: true
24
25
  type:
25
26
  label: Type
26
27
  type: select
27
28
  firstOption: false
29
+ filterable: true
28
30
  options: Profile:profile,Permission set:permission_set
29
31
  defaultValue: permission_set
30
32
  amis:
@@ -36,7 +38,7 @@ fields:
36
38
  reference_to: apps
37
39
  reference_to_field: code
38
40
  name: assigned_apps
39
- filterable: true
41
+ filterable: false
40
42
  default_standard_buttons:
41
43
  label: Default Standard Buttons
42
44
  type: select
@@ -26,6 +26,10 @@ fields:
26
26
  label: 启用
27
27
  type: boolean
28
28
  sort_no: 130
29
+ allowEdit:
30
+ label: 允许编辑
31
+ type: boolean
32
+ sort_no: 135
29
33
  entry_criteria:
30
34
  label: 指定条目条件
31
35
  inlineHelpText: "满足此条件时,使用该记录过滤器。语法为函数表达式, 例如: {{$user.profile !='user'}}"
@@ -64,6 +68,7 @@ list_views:
64
68
  - name
65
69
  - object_name
66
70
  - active
71
+ - allowEdit
67
72
  - entry_criteria
68
73
  - record_filter
69
74
  - description
@@ -77,6 +82,7 @@ list_views:
77
82
  - name
78
83
  - object_name
79
84
  - active
85
+ - allowEdit
80
86
  - entry_criteria
81
87
  - record_filter
82
88
  - description
@@ -2,6 +2,7 @@ const _ = require('underscore');
2
2
  const objectql = require("@steedos/objectql");
3
3
  const InternalData = require('@steedos/standard-objects').internalData;
4
4
  const auth = require("@steedos/auth");
5
+ const clone = require('clone');
5
6
 
6
7
 
7
8
  const permissions = {
@@ -86,11 +87,12 @@ module.exports = {
86
87
  const { spaceId } = this;
87
88
  let dataList = await getInternalPermissionObjects();
88
89
  if (!_.isEmpty(dataList)) {
90
+ const cloneValues = clone(this.data.values, false);
89
91
  dataList.forEach((doc) => {
90
92
  if (!_.find(this.data.values, (value) => {
91
93
  return value.name === doc.name
92
94
  })) {
93
- this.data.values.push(doc);
95
+ cloneValues.push(doc);
94
96
  }
95
97
  })
96
98
 
@@ -114,7 +116,7 @@ module.exports = {
114
116
  }
115
117
  }
116
118
 
117
- const records = objectql.getSteedosSchema().metadataDriver.find(this.data.values, this.query, spaceId);
119
+ const records = objectql.getSteedosSchema().metadataDriver.find(cloneValues, this.query, spaceId);
118
120
  if (records.length > 0) {
119
121
  this.data.values = records;
120
122
  } else {
@@ -1,14 +1,15 @@
1
1
  /*
2
2
  * @Author: baozhoutao@steedos.com
3
3
  * @Date: 2022-08-05 14:17:44
4
- * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2023-05-30 15:10:02
4
+ * @LastEditors: 孙浩林 sunhaolin@steedos.com
5
+ * @LastEditTime: 2024-05-11 14:01:06
6
6
  * @Description:
7
7
  */
8
8
  const _ = require('underscore');
9
9
  const objectql = require('@steedos/objectql');
10
10
  const register = require('@steedos/metadata-registrar');
11
11
  const auth = require("@steedos/auth");
12
+ const clone = require('clone');
12
13
 
13
14
 
14
15
  const getSourcePermissionSets = async function(type){
@@ -28,10 +29,6 @@ module.exports = {
28
29
  delete this.query.fields;
29
30
  },
30
31
 
31
- beforeAggregate: async function () {
32
- delete this.query.fields;
33
- },
34
-
35
32
  afterFind: async function(){
36
33
  let { spaceId } = this;
37
34
  if(!spaceId){
@@ -45,14 +42,15 @@ module.exports = {
45
42
  }
46
43
  let dataList = await getSourcePermissionSets();
47
44
  if (!_.isEmpty(dataList)) {
45
+ const cloneValues = clone(this.data.values, false);
48
46
  dataList.forEach((doc) => {
49
47
  if (!_.find(this.data.values, (value) => {
50
48
  return value.name === doc.name
51
49
  })) {
52
- this.data.values.push(doc);
50
+ cloneValues.push(doc);
53
51
  }
54
52
  })
55
- const records = objectql.getSteedosSchema().metadataDriver.find(this.data.values, this.query, spaceId);
53
+ const records = objectql.getSteedosSchema().metadataDriver.find(cloneValues, this.query, spaceId);
56
54
  if (records.length > 0) {
57
55
  this.data.values = records;
58
56
  } else {
@@ -61,25 +59,6 @@ module.exports = {
61
59
  }
62
60
 
63
61
  },
64
- afterAggregate: async function(){
65
- const { spaceId } = this;
66
- let dataList = await getSourcePermissionSets();
67
- if (!_.isEmpty(dataList)) {
68
- dataList.forEach((doc) => {
69
- if (!_.find(this.data.values, (value) => {
70
- return value.name === doc.name
71
- })) {
72
- this.data.values.push(doc);
73
- }
74
- })
75
- const records = objectql.getSteedosSchema().metadataDriver.find(this.data.values, this.query, spaceId);
76
- if (records.length > 0) {
77
- this.data.values = records;
78
- } else {
79
- this.data.values.length = 0;
80
- }
81
- }
82
- },
83
62
  afterCount: async function(){
84
63
  delete this.query.fields;
85
64
  let result = await objectql.getObject(this.object_name).find(this.query, await auth.getSessionByUserId(this.userId, this.spaceId))
@@ -2,13 +2,14 @@
2
2
  * @Author: sunhaolin@hotoa.com
3
3
  * @Date: 2022-10-26 14:14:51
4
4
  * @LastEditors: 孙浩林 sunhaolin@steedos.com
5
- * @LastEditTime: 2023-07-13 09:56:08
5
+ * @LastEditTime: 2024-05-11 14:01:51
6
6
  * @Description:
7
7
  */
8
8
  const objectql = require('@steedos/objectql');
9
9
  const register = require('@steedos/metadata-registrar');
10
10
  const auth = require('@steedos/auth');
11
11
  const _ = require('underscore');
12
+ const clone = require('clone');
12
13
  async function getAll() {
13
14
  const schema = objectql.getSteedosSchema();
14
15
  const configs = await register.registerPermissionTabs.getAll(schema.broker)
@@ -86,41 +87,19 @@ module.exports = {
86
87
  delete this.query.fields;
87
88
  },
88
89
 
89
- beforeAggregate: async function () {
90
- delete this.query.fields;
91
- },
92
-
93
90
  afterFind: async function () {
94
91
  const { spaceId } = this;
95
92
  let dataList = await getAll();
96
93
  if (dataList) {
94
+ const cloneValues = clone(this.data.values, false);
97
95
  dataList.forEach((doc) => {
98
96
  if (!_.find(this.data.values, (value) => {
99
97
  return value.permission_set === doc.permission_set && value.tab === doc.tab
100
98
  })) {
101
- this.data.values.push(doc);
99
+ cloneValues.push(doc);
102
100
  }
103
101
  })
104
- const records = objectql.getSteedosSchema().metadataDriver.find(this.data.values, this.query, spaceId);
105
- if (records.length > 0) {
106
- this.data.values = records;
107
- } else {
108
- this.data.values.length = 0;
109
- }
110
- }
111
- },
112
- afterAggregate: async function () {
113
- const { spaceId } = this;
114
- let dataList = await getAll();
115
- if (dataList) {
116
- dataList.forEach((doc) => {
117
- if (!_.find(this.data.values, (value) => {
118
- return value.permission_set === doc.permission_set && value.tab === doc.tab
119
- })) {
120
- this.data.values.push(doc);
121
- };
122
- })
123
- const records = objectql.getSteedosSchema().metadataDriver.find(this.data.values, this.query, spaceId);
102
+ const records = objectql.getSteedosSchema().metadataDriver.find(cloneValues, this.query, spaceId);
124
103
  if (records.length > 0) {
125
104
  this.data.values = records;
126
105
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-permission",
3
- "version": "2.7.1-beta.3",
3
+ "version": "2.7.1-beta.31",
4
4
  "main": "package.service.js",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -12,5 +12,8 @@
12
12
  "description": "steedos package",
13
13
  "repository": {},
14
14
  "license": "MIT",
15
- "gitHead": "f154c292cacb12408aa6383e8667a3f6dcd38fb6"
15
+ "gitHead": "c27f9dec3a111f34677f3276a915d9e3afb9ac9b",
16
+ "dependencies": {
17
+ "clone": "^2.1.2"
18
+ }
16
19
  }