@steedos/standard-permission 2.7.0-beta.6 → 2.7.0-beta.7
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
21
|
-
|
|
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'){
|
|
@@ -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
|
+
"version": "2.7.0-beta.7",
|
|
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": "
|
|
15
|
+
"gitHead": "6b88f14e441193de85363a8c187318ad5f33d2ab"
|
|
16
16
|
}
|