@steedos/standard-permission 2.4.0-beta.7 → 2.4.0

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.
@@ -1,5 +1,5 @@
1
1
  name: permission_set
2
- label: Permission Set
2
+ label: Profile & Permission Set
3
3
  description:
4
4
  fields:
5
5
  name:
@@ -1,5 +1,5 @@
1
1
  name: permission_set
2
- label: 权限集
2
+ label: 简档 & 权限集
3
3
  description:
4
4
  fields:
5
5
  name:
@@ -43,24 +43,6 @@ fields:
43
43
  required: true
44
44
  create: false
45
45
  sort_no: 130
46
- optionsFunction: !<tag:yaml.org,2002:js/function> |-
47
- function () {
48
- var _options;
49
-
50
- _options = [];
51
-
52
- _.forEach(Creator.objectsByName, function (o, k) {
53
- if (!o.hidden) {
54
- return _options.push({
55
- label: o.label,
56
- value: k,
57
- icon: o.icon
58
- });
59
- }
60
- });
61
-
62
- return _options;
63
- }
64
46
  name: object_name
65
47
  filterable: true
66
48
  field:
@@ -11,13 +11,13 @@ module.exports = {
11
11
  delete newDoc.is_system;
12
12
 
13
13
  let permissionSetId = doc.permission_set_id
14
- if(_.include(['admin','user','supplier','customer'], doc.permission_set_id)){
14
+ if(_.includes(['admin','user','supplier','customer'], doc.permission_set_id)){
15
15
  let dbPst = Creator.odata.query('permission_set', {$select: "_id", $filter: "(name eq '"+doc.permission_set_id+"') and (space eq '"+Steedos.getSpaceId()+"')"}, true)
16
16
  if(dbPst && dbPst.length > 0){
17
17
  permissionSetId = dbPst[0]._id;
18
18
  }
19
19
 
20
- if(_.include(['admin','user','supplier','customer'], permissionSetId)){
20
+ if(_.includes(['admin','user','supplier','customer'], permissionSetId)){
21
21
  return toastr.error("请先自定义权限集")
22
22
  }
23
23
  }
@@ -32,7 +32,8 @@ module.exports = {
32
32
  }
33
33
  });
34
34
  },
35
- customizeVisible: function(object_name, record_id, record_permissions, record){
35
+ customizeVisible: function(object_name, record_id, record_permissions, data){
36
+ var record = data && data.record;
36
37
  if(!record){
37
38
  record = {}
38
39
  }
@@ -48,10 +49,12 @@ module.exports = {
48
49
  FlowRouter.reload();
49
50
  }
50
51
  },
51
- resetFieldPermissionsVisible: function (object_name, record_id, record_permissions, record) {
52
+ resetFieldPermissionsVisible: function (object_name, record_id, record_permissions, data) {
53
+ var record = data && data.record;
52
54
  if (!record) {
53
55
  record = {}
54
56
  }
55
- return !(Creator.baseObject.actions.standard_new.visible() && record.is_system);
57
+ return Creator.baseObject.actions.standard_new.visible() && !record.is_system;
58
+ // return !(Creator.baseObject.actions.standard_new.visible() && record.is_system);
56
59
  }
57
60
  }
@@ -29,24 +29,6 @@ fields:
29
29
  index: true
30
30
  required: true
31
31
  create: false
32
- optionsFunction: !<tag:yaml.org,2002:js/function> |-
33
- function () {
34
- var _options;
35
-
36
- _options = [];
37
-
38
- _.forEach(Creator.objectsByName, function (o, k) {
39
- if (!o.hidden) {
40
- return _options.push({
41
- label: o.label,
42
- value: k,
43
- icon: o.icon
44
- });
45
- }
46
- });
47
-
48
- return _options;
49
- }
50
32
  name: object_name
51
33
  filterable: true
52
34
  allowRead:
@@ -8,7 +8,8 @@ module.exports = {
8
8
  });
9
9
 
10
10
  },
11
- customizeVisible: function(object_name, record_id, record_permissions, record){
11
+ customizeVisible: function(object_name, record_id, record_permissions, data){
12
+ var record = data && data.record;
12
13
  if(!record){
13
14
  record = {}
14
15
  }
@@ -1,5 +1,5 @@
1
1
  name: permission_set
2
- label: Permission Set
2
+ label: Profile & Permission Set
3
3
  icon: groups
4
4
  hidden: false
5
5
  enable_inline_edit: false
@@ -39,22 +39,8 @@ fields:
39
39
  label: Assigned Apps
40
40
  type: lookup
41
41
  multiple: true
42
- optionsFunction: !<tag:yaml.org,2002:js/function> |-
43
- function () {
44
- var _options;
45
-
46
- _options = [];
47
-
48
- _.forEach(Creator.Apps, function (o, k) {
49
- return _options.push({
50
- label: o.label || o.name,
51
- value: k,
52
- icon: o.icon_slds
53
- });
54
- });
55
-
56
- return _options;
57
- }
42
+ reference_to: apps
43
+ reference_to_field: code
58
44
  name: assigned_apps
59
45
  filterable: true
60
46
  users:
@@ -13,12 +13,9 @@ fields:
13
13
  label: Object
14
14
  type: lookup
15
15
  multiple: true
16
- optionsFunction: !<tag:yaml.org,2002:js/function> |-
17
- function () {
18
- return Steedos.getObjectsOptions(function(o){
19
- return o.enable_share
20
- })
21
- }
16
+ reference_to: objects
17
+ reference_to_field: name
18
+ filters: ["enable_share", "=", true]
22
19
  required: true
23
20
  filterable: true
24
21
  filters:
@@ -24,7 +24,8 @@ module.exports = {
24
24
  }
25
25
  });
26
26
  },
27
- customizeVisible: function (object_name, record_id, record_permissions, record) {
27
+ customizeVisible: function (object_name, record_id, record_permissions, data) {
28
+ var record = data && data.record;
28
29
  return record && Creator.baseObject.actions.standard_new.visible() && record.is_system;
29
30
  }
30
31
  }
@@ -16,7 +16,8 @@ module.exports = {
16
16
  }
17
17
  });
18
18
  },
19
- customizeVisible: function (object_name, record_id, record_permissions, record) {
19
+ customizeVisible: function (object_name, record_id, record_permissions, data) {
20
+ var record = data && data.record;
20
21
  if (!record) {
21
22
  record = {}
22
23
  }
@@ -15,10 +15,6 @@ fields:
15
15
  write_requires_master_read: true
16
16
  reference_to_field: name
17
17
  required: true
18
- optionsFunction: !<tag:yaml.org,2002:js/function> |-
19
- function () {
20
- return Steedos.getObjectsOptions();
21
- }
22
18
  sort_no: 120
23
19
  active:
24
20
  label: 启用
@@ -16,7 +16,8 @@ module.exports = {
16
16
  }
17
17
  });
18
18
  },
19
- customizeVisible: function (object_name, record_id, record_permissions, record) {
19
+ customizeVisible: function (object_name, record_id, record_permissions, data) {
20
+ var record = data && data.record;
20
21
  if (!record) {
21
22
  record = {}
22
23
  }
@@ -49,7 +49,7 @@ async function checkMultiple(permission_set, tab, action, id) {
49
49
  if (!permission_set || !tab) return
50
50
 
51
51
  const pTabObj = objectql.getObject('permission_tabs')
52
- const pTabDocs = await pTabObj.find({
52
+ const pTabDocs = await pTabObj.directFind({
53
53
  filters: [
54
54
  ['permission_set', '=', permission_set],
55
55
  ['tab', '=', tab]
@@ -70,7 +70,8 @@ module.exports = {
70
70
 
71
71
  beforeInsert: async function () {
72
72
  const { doc, id } = this
73
- await checkMultiple(doc.permission_set, doc.tab, 'beforeInsert', id)
73
+
74
+ await checkMultiple(doc.permission_set, doc.tab, 'beforeInsert', null)
74
75
  },
75
76
 
76
77
  beforeUpdate: async function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-permission",
3
- "version": "2.4.0-beta.7",
3
+ "version": "2.4.0",
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": "581c4cad88be53dbc0c6f4c4f13a3e645702d555"
15
+ "gitHead": "70a4e7417d8d86c47cf5c7e3bbe0e89f2cee4222"
16
16
  }