w-web-perm 1.1.8 → 1.1.10

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.
Files changed (51) hide show
  1. package/README.md +14 -4
  2. package/dist/index.tmp +1 -1
  3. package/dist/js/app-legacy.26e909d6.js +1 -0
  4. package/dist/js/app.26e909d6.js +1 -0
  5. package/dist/js/{chunk-vendors-legacy.00f159e8.js → chunk-vendors-legacy.b43f5548.js} +3 -3
  6. package/dist/js/{chunk-vendors.00f159e8.js → chunk-vendors.b43f5548.js} +3 -3
  7. package/dist/w-web-perm.umd.js +2 -2
  8. package/dist/w-web-perm.umd.js.map +1 -1
  9. package/docs/WWebPerm.html +78 -128
  10. package/docs/global.html +1280 -39
  11. package/docs/index.html +2 -2
  12. package/docs/server_WWebPerm.mjs.html +1247 -1196
  13. package/docs/server_dataChannel.mjs.html +131 -0
  14. package/docs/server_lockSave.mjs.html +2 -2
  15. package/docs/server_maskLog.mjs.html +2 -2
  16. package/docs/server_procCore.mjs.html +53 -11
  17. package/docs/server_staLogs_resolveShellWorker.mjs.html +180 -0
  18. package/docs/server_validateRows.mjs.html +184 -0
  19. package/docs/server_wrapInjected.mjs.html +2 -2
  20. package/docs/src_fetchJson.mjs.html +2 -2
  21. package/docs/src_js_legendFit.mjs.html +2 -2
  22. package/docs/src_plugins_reuseDeletedIds.mjs.html +2 -2
  23. package/docs/src_plugins_submitGuard.mjs.html +2 -2
  24. package/g_backupDb.mjs +4 -0
  25. package/g_initialData.mjs +1 -0
  26. package/g_initialTestData.mjs +1 -0
  27. package/g_mOrm.mjs +2 -7
  28. package/g_provideGrups.mjs +1 -0
  29. package/g_providePemis.mjs +1 -0
  30. package/g_provideTargets.mjs +1 -0
  31. package/g_provideUsers.mjs +1 -0
  32. package/package.json +14 -14
  33. package/server/WWebPerm.mjs +1245 -1194
  34. package/server/dataChannel.mjs +59 -0
  35. package/server/procCore.mjs +51 -9
  36. package/server/procLang.mjs +13 -3
  37. package/server/staLogs/resolveShellWorker.mjs +108 -0
  38. package/server/staLogs/staLogsCore.callWorker.mjs +29 -9
  39. package/server/validateRows.mjs +112 -0
  40. package/src/components/LayoutContentGrups.vue +8 -8
  41. package/src/components/LayoutContentPemis.vue +8 -8
  42. package/src/components/LayoutContentTargets.vue +2 -2
  43. package/src/components/LayoutContentUsers.vue +4 -4
  44. package/src/components/VeCgrups.vue +3 -3
  45. package/src/components/VeCpemis.vue +3 -3
  46. package/src/components/VeCrules.vue +3 -3
  47. package/src/components/VeGrupBlngUsers.vue +6 -6
  48. package/src/components/VePemiBlngGrups.vue +6 -6
  49. package/srv.mjs +0 -4
  50. package/dist/js/app-legacy.6f82d8bd.js +0 -1
  51. package/dist/js/app.6f82d8bd.js +0 -1
@@ -29,7 +29,7 @@
29
29
  <nav >
30
30
 
31
31
 
32
- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="WWebPerm.html">WWebPerm</a></li></ul><h3>Global</h3><ul><li><a href="global.html#createLegendMeasurer">createLegendMeasurer</a></li><li><a href="global.html#createLockSave">createLockSave</a></li><li><a href="global.html#decideLegendType">decideLegendType</a></li><li><a href="global.html#describeUpstream">describeUpstream</a></li><li><a href="global.html#fetchJson">fetchJson</a></li><li><a href="global.html#genLegend">genLegend</a></li><li><a href="global.html#maskQuery">maskQuery</a></li><li><a href="global.html#maskTok">maskTok</a></li><li><a href="global.html#maskUrl">maskUrl</a></li><li><a href="global.html#mergePickKeysOnly">mergePickKeysOnly</a></li><li><a href="global.html#reuseDeletedIds">reuseDeletedIds</a></li><li><a href="global.html#submitGuard">submitGuard</a></li><li><a href="global.html#wrapInjected">wrapInjected</a></li></ul>
32
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="WWebPerm.html">WWebPerm</a></li></ul><h3>Global</h3><ul><li><a href="global.html#createAuthorizeExec">createAuthorizeExec</a></li><li><a href="global.html#createLegendMeasurer">createLegendMeasurer</a></li><li><a href="global.html#createLockSave">createLockSave</a></li><li><a href="global.html#decideLegendType">decideLegendType</a></li><li><a href="global.html#describeUpstream">describeUpstream</a></li><li><a href="global.html#fetchJson">fetchJson</a></li><li><a href="global.html#genLegend">genLegend</a></li><li><a href="global.html#maskQuery">maskQuery</a></li><li><a href="global.html#maskTok">maskTok</a></li><li><a href="global.html#maskUrl">maskUrl</a></li><li><a href="global.html#mergePickKeysOnly">mergePickKeysOnly</a></li><li><a href="global.html#resolveShellWorker">resolveShellWorker</a></li><li><a href="global.html#reuseDeletedIds">reuseDeletedIds</a></li><li><a href="global.html#submitGuard">submitGuard</a></li><li><a href="global.html#validateRowsBeforeWrite">validateRowsBeforeWrite</a></li><li><a href="global.html#wrapInjected">wrapInjected</a></li><li><a href="global.html#wrapOperOrm">wrapOperOrm</a></li></ul>
33
33
 
34
34
  </nav>
35
35
 
@@ -80,7 +80,7 @@
80
80
 
81
81
  <dt class="tag-source">Source:</dt>
82
82
  <dd class="tag-source"><ul class="dummy"><li>
83
- <a href="server_WWebPerm.mjs.html">server/WWebPerm.mjs</a>, <a href="server_WWebPerm.mjs.html#line144">line 144</a>
83
+ <a href="server_WWebPerm.mjs.html">server/WWebPerm.mjs</a>, <a href="server_WWebPerm.mjs.html#line140">line 140</a>
84
84
  </li></ul></dd>
85
85
 
86
86
 
@@ -127,7 +127,77 @@
127
127
 
128
128
  <h5 class="h5-examples">Example</h5>
129
129
 
130
- <pre class="prettyprint"><code>import WOrm from 'w-orm-lmdb/src/WOrmLmdb.mjs'
131
130
  useCheckUser: false,
132
131
  getUserById: null,
133
132
  useExcludeWhenNotAdmin: false,
134
133
  serverPort: 11006,
135
134
  subfolder: '', //mperm
136
135
  urlRedirect: 'https://www.google.com/', //本機測試時得先編譯, 再瀏覽: http://localhost:11006/
137
136
  webName: {
138
137
  'eng': 'Permission Service',
139
138
  'cht': '權限管理系統',
140
139
  },
141
140
  webDescription: {
142
141
  'eng': 'A web service package for user permissions and management targets.',
143
142
  'cht': 'A web service package for user permissions and management targets.',
144
143
  },
145
144
  webLogo: 'data:image/svg+xml;base64,...',
146
145
  // return {} //測試無法登入
147
146
  if (token === '{token-for-application}') { //提供外部應用系統作為存取使用者
148
147
  return {
149
148
  id: 'id-for-application',
150
149
  name: 'application',
151
150
  email: 'application@example.com',
152
151
  isAdmin: 'y',
153
152
  }
154
153
  }
155
154
  if (token === 'sys') { //開發階段w-ui-loginout自動給予browser使用者(且位於localhost)的token為sys
156
155
  return {
157
156
  id: 'id-for-admin',
158
157
  name: 'tester',
159
158
  email: 'admin@example.com', //mappingBy為email, 開發階段時會使用email找到所建置之使用者資料
160
159
  isAdmin: 'y',
161
160
  }
162
161
  }
163
162
  console.log('invalid token') //勿印權杖值
164
163
  console.log('於生產環境時得加入SSO等驗證token機制')
165
164
  return {}
166
165
  console.log('verifyClientUser/user', user)
167
166
  // return false //測試無法登入
168
167
  console.log('於生產環境時得加入限制瀏覽器使用者身份機制')
169
168
  return user.isAdmin === 'y' //測試僅系統管理者使用
170
169
  console.log('verifyAppUser/user', user)
171
170
  // return false //測試無法登入
172
171
  console.log('於生產環境時得加入限制應用程式使用者身份機制')
173
172
  return user.isAdmin === 'y' //測試僅系統管理者使用
174
173
  console.log(err)
174
+ <pre class="prettyprint"><code>import WOrm from 'w-orm-lmdb/src/WOrmLmdb.mjs'
175
+ import WWebPerm from './server/WWebPerm.mjs'
176
+ import getSettings from './g_getSettings.mjs'
177
+
178
+
179
+ //st
180
+ let st = getSettings()
181
+
182
+ let url = st.dbUrl
183
+ let db = st.dbName
184
+ let opt = {
185
+
186
+ serverPort: 11006,
187
+ subfolder: '', //mperm
188
+ urlRedirect: 'https://www.google.com/', //本機測試時得先編譯, 再瀏覽: http://localhost:11006/
189
+
190
+ webName: {
191
+ 'eng': 'Permission Service',
192
+ 'cht': '權限管理系統',
193
+ },
194
+ webDescription: {
195
+ 'eng': 'A web service package for user permissions and management targets.',
196
+ 'cht': 'A web service package for user permissions and management targets.',
197
+ },
198
+ webLogo: 'data:image/svg+xml;base64,...',
199
+
200
+ }
201
+
202
+ let getUserByToken = async (token) => {
203
+ // return {} //測試無法登入
204
+ if (token === '{token-for-application}') { //提供外部應用系統作為存取使用者
205
+ return {
206
+ id: 'id-for-application',
207
+ name: 'application',
208
+ email: 'application@example.com',
209
+ isAdmin: 'y',
210
+ }
211
+ }
212
+ if (token === 'sys') { //開發階段w-ui-loginout自動給予browser使用者(且位於localhost)的token為sys
213
+ return {
214
+ id: 'id-for-admin',
215
+ name: 'tester',
216
+ email: 'admin@example.com', //mappingBy為email, 開發階段時會使用email找到所建置之使用者資料
217
+ isAdmin: 'y',
218
+ }
219
+ }
220
+ console.log('invalid token') //勿印權杖值
221
+ console.log('於生產環境時得加入SSO等驗證token機制')
222
+ return {}
223
+ }
224
+
225
+ let verifyClientUser = (user, from) => {
226
+ console.log('verifyClientUser/user', user)
227
+ // return false //測試無法登入
228
+ console.log('於生產環境時得加入限制瀏覽器使用者身份機制')
229
+ return user.isAdmin === 'y' //測試僅系統管理者使用
230
+ }
231
+
232
+ let verifyAppUser = (user, from) => {
233
+ console.log('verifyAppUser/user', user)
234
+ // return false //測試無法登入
235
+ console.log('於生產環境時得加入限制應用程式使用者身份機制')
236
+ return user.isAdmin === 'y' //測試僅系統管理者使用
237
+ }
238
+
239
+ //WWebPerm
240
+ let instWWebPerm = WWebPerm(WOrm, url, db, getUserByToken, verifyClientUser, verifyAppUser, opt)
241
+
242
+ instWWebPerm.on('error', (err) => {
243
+ console.log(err)
244
+ })</code></pre>
175
245
 
176
246
 
177
247
 
@@ -473,127 +543,7 @@
473
543
  </td>
474
544
 
475
545
 
476
- <td class="description last"><p>輸入伺服器通訊port,預設11006</p></td>
477
- </tr>
478
-
479
-
480
-
481
- <tr>
482
-
483
- <td class="name"><code>useCheckUser</code></td>
484
-
485
-
486
- <td class="type">
487
-
488
-
489
- <span class="param-type">Boolean</span>
490
-
491
-
492
-
493
-
494
- </td>
495
-
496
-
497
- <td class="attributes">
498
-
499
- &lt;optional><br>
500
-
501
-
502
-
503
-
504
-
505
- </td>
506
-
507
-
508
-
509
- <td class="default">
510
-
511
- <code>false</code>
512
-
513
- </td>
514
-
515
-
516
- <td class="description last"><p>輸入是否檢查使用者資訊布林值,預設false</p></td>
517
- </tr>
518
-
519
-
520
-
521
- <tr>
522
-
523
- <td class="name"><code>getUserById</code></td>
524
-
525
-
526
- <td class="type">
527
-
528
-
529
- <span class="param-type">function</span>
530
-
531
-
532
-
533
-
534
- </td>
535
-
536
-
537
- <td class="attributes">
538
-
539
- &lt;optional><br>
540
-
541
-
542
-
543
-
544
-
545
- </td>
546
-
547
-
548
-
549
- <td class="default">
550
-
551
- <code>null</code>
552
-
553
- </td>
554
-
555
-
556
- <td class="description last"><p>輸入當useCheckUser=true時依照使用者ID取得使用者資訊物件函數,預設null</p></td>
557
- </tr>
558
-
559
-
560
-
561
- <tr>
562
-
563
- <td class="name"><code>useExcludeWhenNotAdmin</code></td>
564
-
565
-
566
- <td class="type">
567
-
568
-
569
- <span class="param-type">Boolean</span>
570
-
571
-
572
-
573
-
574
- </td>
575
-
576
-
577
- <td class="attributes">
578
-
579
- &lt;optional><br>
580
-
581
-
582
-
583
-
584
-
585
- </td>
586
-
587
-
588
-
589
- <td class="default">
590
-
591
- <code>false</code>
592
-
593
- </td>
594
-
595
-
596
- <td class="description last"><p>輸入使用ORM的select方法時是否自動刪除數據內isActive欄位之布林值,預設false</p></td>
546
+ <td class="description last"><p>輸入伺服器通訊port,預設11006。註:原opt.useCheckUser、opt.getUserById、opt.useExcludeWhenNotAdmin已隨w-serv-orm 1.1.9移除,給予undefined、null、false以外之值時建構即拋錯(錯誤訊息出自w-serv-orm之checkOptRemoved,並記srLog);資料通道之使用者授權由verifyConn(verifyClientUser)負責、表操作只開放select,刪除該三鍵即可,無須替代設定</p></td>
597
547
  </tr>
598
548
 
599
549
 
@@ -828,12 +778,12 @@
828
778
 
829
779
  <td class="default">
830
780
 
831
- <code>'email'</code>
781
+ <code>'id'</code>
832
782
 
833
783
  </td>
834
784
 
835
785
 
836
- <td class="description last"><p>輸入外部系統識別使用者token後所提供之資料物件,與權限系統之使用者資料物件,兩者間查找之對應欄位,可選'id'、'email'、'name',預設'email'</p></td>
786
+ <td class="description last"><p>輸入外部系統識別使用者token後所提供之資料物件,與權限系統之使用者資料物件,兩者間查找之對應欄位,可選'id'、'email'、'name',未給或非此三者時為'id',預設'id'</p></td>
837
787
  </tr>
838
788
 
839
789
 
@@ -986,7 +936,7 @@
986
936
 
987
937
 
988
938
  <div class="param-desc">
989
- <p>回傳物件,其內server為hapi伺服器實體,wsrv為w-converhp的伺服器事件物件,wsds為w-serv-webdata的伺服器事件物件,可監聽error事件</p>
939
+ <p>回傳w-serv-hapi之WServHapiServer事件物件,可監聽error事件;另提供ready函數(回傳promise,啟動成功resolve為hapi伺服器實體,失敗如埠被占用時reject)、stop函數(釋放資料同步等下游資源後停止伺服器)、getServer函數與getInstWConverServer函數。資料通道之表操作只開放select(新增、修改、刪除一律經updateTargets等函數);設定錯誤(含已移除之opt鍵)於建構時同步拋出並記srLog</p>
990
940
  </div>
991
941
 
992
942
 
@@ -1045,7 +995,7 @@
1045
995
  <br class="clear">
1046
996
 
1047
997
  <footer>
1048
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Oct 11 2026 16:35:27 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
998
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Tue Oct 20 2026 06:46:43 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1049
999
  </footer>
1050
1000
 
1051
1001
  <script>prettyPrint();</script>