w-web-perm 1.0.0 → 1.0.1
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/dist/index.tmp +1 -1
- package/dist/js/app-legacy.a31aa3a9.js +2 -0
- package/dist/js/app-legacy.a31aa3a9.js.map +1 -0
- package/dist/js/app.a31aa3a9.js +2 -0
- package/dist/js/app.a31aa3a9.js.map +1 -0
- package/dist/w-web-perm.umd.js +2 -2
- package/dist/w-web-perm.umd.js.map +1 -1
- package/docs/WWebPerm.html +1 -1
- package/docs/WWebPerm.mjs.html +5 -5
- package/docs/index.html +1 -1
- package/package.json +2 -2
- package/server/WWebPerm.mjs +4 -4
- package/src/perm.mjs +27 -22
- package/src/plugins/mShare.mjs +0 -152
- package/src/schema/tables/ruleGroups.mjs +1 -1
- package/src/schema/tables/targets.mjs +4 -4
- package/src/schema/tables/users.mjs +1 -1
- package/tableTags-web-perm.json +1 -1
- package/dist/js/app-legacy.954e168c.js +0 -2
- package/dist/js/app-legacy.954e168c.js.map +0 -1
- package/dist/js/app.954e168c.js +0 -2
- package/dist/js/app.954e168c.js.map +0 -1
package/docs/WWebPerm.html
CHANGED
|
@@ -813,7 +813,7 @@
|
|
|
813
813
|
<br class="clear">
|
|
814
814
|
|
|
815
815
|
<footer>
|
|
816
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
816
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Thu Jul 20 2023 00:07:52 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
817
817
|
</footer>
|
|
818
818
|
|
|
819
819
|
<script>prettyPrint();</script>
|
package/docs/WWebPerm.mjs.html
CHANGED
|
@@ -286,7 +286,7 @@ function WWebPerm(WOrm, url, db, getUserByToken, opt = {}) {
|
|
|
286
286
|
//userFind
|
|
287
287
|
let userFind = await woItems.users.select({ [mappingBy]: vSelf, isActive: 'y' })
|
|
288
288
|
userFind = get(userFind, 0, null)
|
|
289
|
-
console.log('userFind', userFind)
|
|
289
|
+
// console.log('userFind', userFind)
|
|
290
290
|
|
|
291
291
|
//複寫isAdmin
|
|
292
292
|
let isAdminSrc = get(userSelf, 'isAdmin', '')
|
|
@@ -294,7 +294,7 @@ function WWebPerm(WOrm, url, db, getUserByToken, opt = {}) {
|
|
|
294
294
|
if (isAdminSrc !== isAdminSelf) {
|
|
295
295
|
userFind.isAdmin = isAdminSelf
|
|
296
296
|
}
|
|
297
|
-
console.log('userFind(isAdmin)', userFind)
|
|
297
|
+
// console.log('userFind(isAdmin)', userFind)
|
|
298
298
|
|
|
299
299
|
return userFind
|
|
300
300
|
}
|
|
@@ -339,7 +339,7 @@ function WWebPerm(WOrm, url, db, getUserByToken, opt = {}) {
|
|
|
339
339
|
// console.log('userFind', userFind)
|
|
340
340
|
|
|
341
341
|
//ruleGroups
|
|
342
|
-
let ruleGroups = await woItems.ruleGroups.select(
|
|
342
|
+
let ruleGroups = await woItems.ruleGroups.select()
|
|
343
343
|
// console.log('ruleGroups', ruleGroups)
|
|
344
344
|
|
|
345
345
|
//targets
|
|
@@ -358,7 +358,7 @@ function WWebPerm(WOrm, url, db, getUserByToken, opt = {}) {
|
|
|
358
358
|
|
|
359
359
|
return {
|
|
360
360
|
user: userFind,
|
|
361
|
-
|
|
361
|
+
rules: urs,
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
|
|
@@ -545,7 +545,7 @@ export default WWebPerm
|
|
|
545
545
|
<br class="clear">
|
|
546
546
|
|
|
547
547
|
<footer>
|
|
548
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
548
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Thu Jul 20 2023 00:07:52 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
549
549
|
</footer>
|
|
550
550
|
|
|
551
551
|
<script>prettyPrint();</script>
|
package/docs/index.html
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
<br class="clear">
|
|
72
72
|
|
|
73
73
|
<footer>
|
|
74
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
74
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Thu Jul 20 2023 00:07:52 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
75
75
|
</footer>
|
|
76
76
|
|
|
77
77
|
<script>prettyPrint();</script>
|
package/package.json
CHANGED
package/server/WWebPerm.mjs
CHANGED
|
@@ -239,7 +239,7 @@ function WWebPerm(WOrm, url, db, getUserByToken, opt = {}) {
|
|
|
239
239
|
//userFind
|
|
240
240
|
let userFind = await woItems.users.select({ [mappingBy]: vSelf, isActive: 'y' })
|
|
241
241
|
userFind = get(userFind, 0, null)
|
|
242
|
-
console.log('userFind', userFind)
|
|
242
|
+
// console.log('userFind', userFind)
|
|
243
243
|
|
|
244
244
|
//複寫isAdmin
|
|
245
245
|
let isAdminSrc = get(userSelf, 'isAdmin', '')
|
|
@@ -247,7 +247,7 @@ function WWebPerm(WOrm, url, db, getUserByToken, opt = {}) {
|
|
|
247
247
|
if (isAdminSrc !== isAdminSelf) {
|
|
248
248
|
userFind.isAdmin = isAdminSelf
|
|
249
249
|
}
|
|
250
|
-
console.log('userFind(isAdmin)', userFind)
|
|
250
|
+
// console.log('userFind(isAdmin)', userFind)
|
|
251
251
|
|
|
252
252
|
return userFind
|
|
253
253
|
}
|
|
@@ -292,7 +292,7 @@ function WWebPerm(WOrm, url, db, getUserByToken, opt = {}) {
|
|
|
292
292
|
// console.log('userFind', userFind)
|
|
293
293
|
|
|
294
294
|
//ruleGroups
|
|
295
|
-
let ruleGroups = await woItems.ruleGroups.select(
|
|
295
|
+
let ruleGroups = await woItems.ruleGroups.select()
|
|
296
296
|
// console.log('ruleGroups', ruleGroups)
|
|
297
297
|
|
|
298
298
|
//targets
|
|
@@ -311,7 +311,7 @@ function WWebPerm(WOrm, url, db, getUserByToken, opt = {}) {
|
|
|
311
311
|
|
|
312
312
|
return {
|
|
313
313
|
user: userFind,
|
|
314
|
-
|
|
314
|
+
rules: urs,
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
|
package/src/perm.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import axios from 'axios'
|
|
2
2
|
import isestr from 'wsemi/src/isestr.mjs'
|
|
3
|
-
import genPm from 'wsemi/src/genPm.mjs'
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
let _url = ''
|
|
@@ -11,42 +10,48 @@ function iniPerm(url) {
|
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
function getPerm(token = '') {
|
|
15
14
|
|
|
16
15
|
//check
|
|
17
16
|
if (!isestr(_url)) {
|
|
18
17
|
throw new Error(`invalid url, need to use iniPerm to set url`)
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
//pm
|
|
22
|
-
let pm = genPm()
|
|
20
|
+
// //pm
|
|
21
|
+
// let pm = genPm()
|
|
23
22
|
|
|
24
23
|
//url
|
|
25
|
-
let url =
|
|
24
|
+
let url = ''
|
|
25
|
+
if (isestr(token)) {
|
|
26
|
+
url = `${_url}?token=${token}`
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
url = _url
|
|
30
|
+
}
|
|
26
31
|
|
|
27
32
|
//axios
|
|
28
|
-
|
|
33
|
+
let pm = axios({
|
|
29
34
|
method: 'get',
|
|
30
35
|
url,
|
|
31
36
|
// headers: { 'Content-Type': 'application/json; charset=utf-8' },
|
|
32
37
|
// data: rin,
|
|
33
38
|
})
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
// .then((res) => {
|
|
40
|
+
// console.log(res)
|
|
41
|
+
// let r = {
|
|
42
|
+
// msg: '成功取得使用者權限',
|
|
43
|
+
// res,
|
|
44
|
+
// }
|
|
45
|
+
// pm.resolve(r)
|
|
46
|
+
// })
|
|
47
|
+
// .catch((err) => {
|
|
48
|
+
// console.log(err)
|
|
49
|
+
// let r = {
|
|
50
|
+
// msg: '取得使用者權限發生錯誤',
|
|
51
|
+
// res: err,
|
|
52
|
+
// }
|
|
53
|
+
// pm.reject(r)
|
|
54
|
+
// })
|
|
50
55
|
|
|
51
56
|
return pm
|
|
52
57
|
}
|
package/src/plugins/mShare.mjs
CHANGED
|
@@ -1,169 +1,17 @@
|
|
|
1
1
|
//前後端共用函數區
|
|
2
|
-
// import min from 'lodash/min'
|
|
3
|
-
// import size from 'lodash/size'
|
|
4
|
-
// import take from 'lodash/take'
|
|
5
|
-
// import isEqual from 'lodash/isEqual'
|
|
6
|
-
import uniq from 'lodash/uniq'
|
|
7
|
-
// import set from 'lodash/set'
|
|
8
2
|
import get from 'lodash/get'
|
|
9
3
|
import each from 'lodash/each'
|
|
10
4
|
import map from 'lodash/map'
|
|
11
5
|
import find from 'lodash/find'
|
|
12
|
-
import filter from 'lodash/filter'
|
|
13
|
-
// import last from 'lodash/last'
|
|
14
|
-
// import size from 'lodash/size'
|
|
15
|
-
import split from 'lodash/split'
|
|
16
6
|
import join from 'lodash/join'
|
|
17
7
|
import cloneDeep from 'lodash/cloneDeep'
|
|
18
8
|
import takeRight from 'lodash/takeRight'
|
|
19
9
|
import dropRight from 'lodash/dropRight'
|
|
20
10
|
import sortBy from 'lodash/sortBy'
|
|
21
11
|
import sep from 'wsemi/src/sep.mjs'
|
|
22
|
-
import isarr from 'wsemi/src/isarr.mjs'
|
|
23
|
-
import isstr from 'wsemi/src/isstr.mjs'
|
|
24
12
|
import iseobj from 'wsemi/src/iseobj.mjs'
|
|
25
13
|
import haskey from 'wsemi/src/haskey.mjs'
|
|
26
14
|
import composeToTree from 'wsemi/src/composeToTree.mjs'
|
|
27
|
-
// import getFileAccept from 'wsemi/src/getFileAccept.mjs'
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// function atSep(attachmentsIds) {
|
|
31
|
-
|
|
32
|
-
// //ts
|
|
33
|
-
// let ts = sep(attachmentsIds, ';')
|
|
34
|
-
|
|
35
|
-
// return ts
|
|
36
|
-
// }
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// function atJoin(ts) {
|
|
40
|
-
|
|
41
|
-
// //uniq
|
|
42
|
-
// ts = uniq(ts)
|
|
43
|
-
|
|
44
|
-
// //str
|
|
45
|
-
// let str = join(ts, ';')
|
|
46
|
-
|
|
47
|
-
// return str
|
|
48
|
-
// }
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// function atParse(attachmentsIds) {
|
|
52
|
-
|
|
53
|
-
// //ts
|
|
54
|
-
// let ts = atSep(attachmentsIds)
|
|
55
|
-
|
|
56
|
-
// //ids
|
|
57
|
-
// let ids = map(ts, (v) => {
|
|
58
|
-
// let s = sep(v, '@')
|
|
59
|
-
// let table = get(s, 0, '')
|
|
60
|
-
// let id = get(s, 1, '')
|
|
61
|
-
// if (table === '') {
|
|
62
|
-
// console.log('atParse: invalid table in attachmentsIds', attachmentsIds)
|
|
63
|
-
// }
|
|
64
|
-
// if (id === '') {
|
|
65
|
-
// console.log('atParse: invalid id in attachmentsIds', attachmentsIds)
|
|
66
|
-
// }
|
|
67
|
-
// return {
|
|
68
|
-
// table,
|
|
69
|
-
// id,
|
|
70
|
-
// }
|
|
71
|
-
// })
|
|
72
|
-
|
|
73
|
-
// return ids
|
|
74
|
-
// }
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
// function atRemove(inp, removeId, opt = {}) {
|
|
78
|
-
|
|
79
|
-
// //removeId
|
|
80
|
-
// if (!isstr(removeId)) {
|
|
81
|
-
// removeId = ''
|
|
82
|
-
// }
|
|
83
|
-
// if (removeId.indexOf('@') >= 0) {
|
|
84
|
-
// removeId = split(removeId, '@')[1] //取後面id
|
|
85
|
-
// }
|
|
86
|
-
|
|
87
|
-
// //ids
|
|
88
|
-
// let ids = []
|
|
89
|
-
// let returnTypeTemp = ''
|
|
90
|
-
// if (isarr(inp)) {
|
|
91
|
-
// ids = inp
|
|
92
|
-
// returnTypeTemp = 'array'
|
|
93
|
-
// }
|
|
94
|
-
// else if (isstr(inp)) {
|
|
95
|
-
// ids = atParse(inp)
|
|
96
|
-
// returnTypeTemp = 'string'
|
|
97
|
-
// }
|
|
98
|
-
|
|
99
|
-
// //returnType
|
|
100
|
-
// let returnType = get(opt, 'returnType', null)
|
|
101
|
-
// if (returnType !== 'array' && returnType !== 'string') {
|
|
102
|
-
// returnType = returnTypeTemp
|
|
103
|
-
// }
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
// //filter
|
|
107
|
-
// ids = filter(ids, (v) => {
|
|
108
|
-
// return v.id !== removeId
|
|
109
|
-
// })
|
|
110
|
-
|
|
111
|
-
// if (returnType === 'array') {
|
|
112
|
-
// return ids
|
|
113
|
-
// }
|
|
114
|
-
// return atMerge(ids)
|
|
115
|
-
// }
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
// function atMerge(ids) {
|
|
119
|
-
|
|
120
|
-
// //ts
|
|
121
|
-
// let ts = map(ids, (v) => {
|
|
122
|
-
// let table = get(v, 'table', '')
|
|
123
|
-
// let id = get(v, 'id', '')
|
|
124
|
-
// if (table === '') {
|
|
125
|
-
// console.log('atMerge: invalid table in ids', ids)
|
|
126
|
-
// }
|
|
127
|
-
// if (id === '') {
|
|
128
|
-
// console.log('atMerge: invalid id in ids', ids)
|
|
129
|
-
// }
|
|
130
|
-
// return `${table}@${id}`
|
|
131
|
-
// })
|
|
132
|
-
|
|
133
|
-
// return atJoin(ts)
|
|
134
|
-
// }
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
// function isNumOrEng(str) {
|
|
138
|
-
// let regExp = /^[\d|a-zA-Z]+$/
|
|
139
|
-
// if (regExp.test(str)) {
|
|
140
|
-
// return true
|
|
141
|
-
// }
|
|
142
|
-
// else {
|
|
143
|
-
// return false
|
|
144
|
-
// }
|
|
145
|
-
// }
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
// function extractFileType(fileName, fileType) {
|
|
149
|
-
// let r = ''
|
|
150
|
-
|
|
151
|
-
// //find
|
|
152
|
-
// let ar = getFileAccept()
|
|
153
|
-
// for (let i = 0; i < ar.length; i++) {
|
|
154
|
-
// if (ar[i].acp === fileType) {
|
|
155
|
-
// return ar[i].name
|
|
156
|
-
// }
|
|
157
|
-
// }
|
|
158
|
-
|
|
159
|
-
// //from name ext
|
|
160
|
-
// let s = split(fileName, '.')
|
|
161
|
-
// if (size(s) > 1) {
|
|
162
|
-
// return last(s)
|
|
163
|
-
// }
|
|
164
|
-
|
|
165
|
-
// return r
|
|
166
|
-
// }
|
|
167
15
|
|
|
168
16
|
|
|
169
17
|
function getAllBlocks(targets) {
|
|
@@ -3,7 +3,7 @@ import keys from 'lodash/keys'
|
|
|
3
3
|
import genID from 'wsemi/src/genID.mjs'
|
|
4
4
|
import dtmapping from 'wsemi/src/dtmapping.mjs'
|
|
5
5
|
import dtpick from 'wsemi/src/dtpick.mjs'
|
|
6
|
-
import nowms2str from 'wsemi/src/nowms2str.mjs'
|
|
6
|
+
// import nowms2str from 'wsemi/src/nowms2str.mjs'
|
|
7
7
|
import now2strp from 'wsemi/src/now2strp.mjs'
|
|
8
8
|
|
|
9
9
|
|
|
@@ -38,9 +38,9 @@ let settings = {
|
|
|
38
38
|
let funNew = (ndata = {}) => {
|
|
39
39
|
let o = dtmapping(ndata, keys(settings))
|
|
40
40
|
o.id = `${now2strp()}-${genID()}`
|
|
41
|
-
o.timeCreate = nowms2str()
|
|
42
|
-
o.timeUpdate = o.timeCreate
|
|
43
|
-
o.isActive = 'y'
|
|
41
|
+
// o.timeCreate = nowms2str()
|
|
42
|
+
// o.timeUpdate = o.timeCreate
|
|
43
|
+
// o.isActive = 'y'
|
|
44
44
|
return o
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -104,7 +104,7 @@ let funTest = () => {
|
|
|
104
104
|
rs[3].from = 'teamB'
|
|
105
105
|
rs[4].from = 'teamB'
|
|
106
106
|
rs[4].isActive = 'n'
|
|
107
|
-
rs[5].ruleGroupsIds = `id-for
|
|
107
|
+
rs[5].ruleGroupsIds = `id-for-權限群組1`
|
|
108
108
|
rs[5].description = '測試系統管理員描述說明'
|
|
109
109
|
rs[5].isAdmin = 'y' //admin
|
|
110
110
|
console.log(`已產生: ${keyTable} 測試資料`, rs)
|
package/tableTags-web-perm.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"ruleGroups":"
|
|
1
|
+
{"ruleGroups":"rXJNLB","targets":"4GLDb2","users":"AG7IvW"}
|