@steedos/standard-permission 2.7.0-beta.3 → 2.7.0-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.
@@ -76,10 +76,10 @@ fields:
76
76
  }
77
77
  readable:
78
78
  type: boolean
79
- label: 允许查看
79
+ label: 可见
80
80
  sort_no: 150
81
81
  editable:
82
- label: 允许编辑
82
+ label: 可编辑
83
83
  type: boolean
84
84
  sort_no: 160
85
85
  is_system:
@@ -131,25 +131,6 @@ list_views:
131
131
  - editable
132
132
  - is_system
133
133
  filter_scope: space
134
- form:
135
- onValuesChange: !!js/function |
136
- function(props){
137
- const { changedValues, values, form } = props;
138
- const readonlyFields = ['created', 'created_by', 'modified', 'modified_by'];
139
- if(changedValues.editable){
140
- if(window._.include(readonlyFields, values.field)){
141
- return setTimeout(function(){
142
- form.setFieldsValue({editable: false})
143
- }, 50)
144
- }
145
- form.setFieldsValue({readable: true});
146
- }
147
-
148
- if(_.has(changedValues, 'readable') && !changedValues.readable && values.editable){
149
- form.setFieldsValue({editable: false})
150
- }
151
- }
152
-
153
134
  permission_set:
154
135
  user:
155
136
  allowCreate: false
@@ -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
@@ -372,15 +339,4 @@ permission_set:
372
339
  allowEdit: true
373
340
  allowRead: true
374
341
  modifyAllRecords: true
375
- viewAllRecords: true
376
- form:
377
- beforeView: !!js/function |
378
- function(){
379
- /*附件权限需要兼容之前没有附件权限配置功能时的设置,取好默认值显示即可*/
380
- Creator.processPermissions(this.doc);
381
- }
382
- beforeEdit: !!js/function |
383
- function(){
384
- /*附件权限需要兼容之前没有附件权限配置功能时的设置,取好默认值显示即可*/
385
- Creator.processPermissions(this.doc);
386
- }
342
+ viewAllRecords: true
@@ -238,37 +238,4 @@ permission_set:
238
238
  allowEdit: false
239
239
  allowRead: false
240
240
  modifyAllRecords: false
241
- viewAllRecords: false
242
- form:
243
- initialValues: !!js/function |
244
- function(){
245
- var listView = Creator.getListView();
246
- if(listView && listView.name === 'profile'){
247
- return {type: 'profile'}
248
- }
249
- return {}
250
- }
251
- beforeEdit: !!js/function |
252
- function(){
253
- Steedos.PermissionSetManager.changeSchema(this.doc, this.schema);
254
- }
255
- afterEdit: !!js/function |
256
- function(){
257
- Steedos.PermissionSetManager.changeSchema(this.doc, this.schema);
258
- }
259
- beforeView: !!js/function |
260
- function(){
261
- Steedos.PermissionSetManager.changeSchema(this.doc, this.schema);
262
- }
263
- beforeInsert: !!js/function |
264
- function(){
265
- if(this.doc && _.isString(this.doc.users)){
266
- this.doc.users = this.doc.users.split(',');
267
- }
268
- }
269
- beforeUpdate: !!js/function |
270
- function(){
271
- if(this.doc && _.isString(this.doc.users)){
272
- this.doc.users = this.doc.users.split(',');
273
- }
274
- }
241
+ viewAllRecords: false
@@ -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.3",
3
+ "version": "2.7.0-beta.30",
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": "753d7fa0840e6e254423eafbdd132ec10ca4072e"
15
+ "gitHead": "c886ced355a573a7c11b9daba97b2f6916328d89"
16
16
  }