@steedos/standard-permission 2.7.1-beta.3 → 2.7.1-beta.30
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.
- package/main/default/objectTranslations/permission_shares.en/permission_shares.en.objectTranslation.yml +2 -0
- package/main/default/objectTranslations/permission_shares.zh-CN/permission_shares.zh-CN.objectTranslation.yml +2 -0
- package/main/default/objects/permission_set/permission_set.object.yml +3 -1
- package/main/default/objects/share_rules.object.yml +6 -0
- package/main/default/triggers/permission_objects.trigger.js +4 -2
- package/main/default/triggers/permission_set.trigger.js +6 -27
- package/main/default/triggers/permission_tabs_metadata.trigger.js +5 -26
- package/package.json +5 -2
|
@@ -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:
|
|
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
|
-
|
|
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(
|
|
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:
|
|
5
|
-
* @LastEditTime:
|
|
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
|
-
|
|
50
|
+
cloneValues.push(doc);
|
|
53
51
|
}
|
|
54
52
|
})
|
|
55
|
-
const records = objectql.getSteedosSchema().metadataDriver.find(
|
|
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:
|
|
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
|
-
|
|
99
|
+
cloneValues.push(doc);
|
|
102
100
|
}
|
|
103
101
|
})
|
|
104
|
-
const records = objectql.getSteedosSchema().metadataDriver.find(
|
|
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
|
+
"version": "2.7.1-beta.30",
|
|
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": "
|
|
15
|
+
"gitHead": "232d409d0485f7d42821690909ff199050548e74",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"clone": "^2.1.2"
|
|
18
|
+
}
|
|
16
19
|
}
|