@steedos/standard-permission 2.7.0-beta.1 → 2.7.0-beta.11

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.
@@ -11,16 +11,16 @@ module.exports = {
11
11
  delete newDoc.is_system;
12
12
 
13
13
  let permissionSetId = doc.permission_set_id
14
- if(_.includes(['admin','user','supplier','customer'], doc.permission_set_id)){
15
- let dbPst = Creator.odata.query('permission_set', {$select: "_id", $filter: "(name eq '"+doc.permission_set_id+"') and (space eq '"+Steedos.getSpaceId()+"')"}, true)
16
- if(dbPst && dbPst.length > 0){
17
- permissionSetId = dbPst[0]._id;
18
- }
14
+ // if(_.includes(['admin','user','supplier','customer'], doc.permission_set_id)){
15
+ // let dbPst = Creator.odata.query('permission_set', {$select: "_id", $filter: "(name eq '"+doc.permission_set_id+"') and (space eq '"+Steedos.getSpaceId()+"')"}, true)
16
+ // if(dbPst && dbPst.length > 0){
17
+ // permissionSetId = dbPst[0]._id;
18
+ // }
19
19
 
20
- if(_.includes(['admin','user','supplier','customer'], permissionSetId)){
21
- return toastr.error("请先自定义权限集")
22
- }
23
- }
20
+ // if(_.includes(['admin','user','supplier','customer'], permissionSetId)){
21
+ // return toastr.error("请先自定义权限集")
22
+ // }
23
+ // }
24
24
  Creator.odata.insert(object_name, Object.assign(newDoc, {permission_set_id: permissionSetId}), function(result, error){
25
25
  if (result) {
26
26
  if(Session.get("object_name") === 'permission_objects'){
@@ -102,39 +102,6 @@ fields:
102
102
  type: boolean
103
103
  label: Allow Create ListViews
104
104
  defaultValue: true
105
- disabled_list_views:
106
- type: lookup
107
- reference_to: object_listviews
108
- label: Disabled ListViews
109
- multiple: true
110
- depend_on:
111
- - object_name
112
- defaultIcon: lead_list
113
- optionsFunction: !<tag:yaml.org,2002:js/function> |-
114
- function (values) {
115
- var _object, _options, list_views;
116
-
117
- _options = [];
118
- var objectName = values.object_name;
119
- if(_.isObject(values.object_name)){
120
- objectName = objectName.name
121
- }
122
- _object = Creator.getObject(objectName);
123
- list_views = _object.list_views;
124
-
125
- _.forEach(list_views, function (f, k) {
126
- if (k !== "default" && (!_.has(f, "shared") || f.shared)) {
127
- return _options.push({
128
- label: f.label || f.name || k,
129
- value: f._id
130
- });
131
- }
132
- });
133
-
134
- return _options;
135
- }
136
- name: disabled_list_views
137
- filterable: true
138
105
  allowExport:
139
106
  type: boolean
140
107
  label: Allow Export Excel
@@ -146,6 +146,29 @@ module.exports = {
146
146
  },
147
147
  beforeInsert: async function(){
148
148
  let doc = this.doc;
149
+
150
+ let permissionSetId = doc.permission_set_id
151
+ if(_.includes(['admin','user','supplier','customer'], doc.permission_set_id)){
152
+ let dbPst = Creator.getCollection("permission_set").direct.find({name: doc.permission_set_id});
153
+ if(dbPst && dbPst.length > 0){
154
+ permissionSetId = dbPst[0]._id;
155
+ const dbDoc = dbPst[0]
156
+ if(_.includes(['admin','user','supplier','customer'], permissionSetId)){
157
+ permissionSetId = Creator.getCollection("permission_set")._makeNewID()
158
+ Creator.getCollection("permission_set").insert({
159
+ _id: permissionSetId,
160
+ name: dbDoc.name, label: dbDoc.label, type: dbDoc.type,
161
+ license: dbDoc.license, lockout_interval: dbDoc.lockout_interval,
162
+ max_login_attempts: dbDoc.max_login_attempts,
163
+ password_history: dbDoc.password_history,
164
+ default_standard_buttons: dbDoc.default_standard_buttons
165
+ });
166
+ }
167
+ }
168
+ }
169
+
170
+ doc.permission_set_id = permissionSetId;
171
+
149
172
  let existedCount = Creator.getCollection("permission_objects").direct.find({permission_set_id: doc.permission_set_id, object_name: doc.object_name, space: doc.space}).count()
150
173
  if(existedCount > 0){
151
174
  throw new Error("此对象已有权限对象记录")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-permission",
3
- "version": "2.7.0-beta.1",
3
+ "version": "2.7.0-beta.11",
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": "529efb7f06c4454d4351500c6e47bd7b7602f64d"
15
+ "gitHead": "3a99b902d0e03a0aa4cd169a77fc482795c01137"
16
16
  }