w-web-perm 1.0.2 → 1.0.3

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * w-web-perm v1.0.2
2
+ * w-web-perm v1.0.3
3
3
  * (c) 2018-2021 yuda-lyu(semisphere)
4
4
  * Released under the MIT License.
5
5
  */
@@ -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 Sun Jul 30 2023 21:50:08 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
816
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Mon Jul 31 2023 10:16:16 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
817
817
  </footer>
818
818
 
819
819
  <script>prettyPrint();</script>
@@ -595,7 +595,7 @@ export default WWebPerm
595
595
  <br class="clear">
596
596
 
597
597
  <footer>
598
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Sun Jul 30 2023 21:50:08 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
598
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Mon Jul 31 2023 10:16:16 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
599
599
  </footer>
600
600
 
601
601
  <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 Sun Jul 30 2023 21:50:08 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
74
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Mon Jul 31 2023 10:16:16 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
75
75
  </footer>
76
76
 
77
77
  <script>prettyPrint();</script>
@@ -0,0 +1,147 @@
1
+ import map from 'lodash/map'
2
+ import ds from './src/schema/index.mjs'
3
+ import { woItems } from './g.mOrm.mjs'
4
+
5
+
6
+ async function initialData() {
7
+ let rs
8
+
9
+
10
+ //人工建置數據時得要嚴格建立各階分層, 否則會無法查找到自動建立之parentId
11
+ rs = [
12
+ '主要資訊',
13
+ '主要資訊/主選單區',
14
+ '主要資訊/內容區',
15
+ '主要資訊/內容區/待處理任務區',
16
+ '計畫資料管理系統',
17
+ '計畫資料管理系統/主選單區',
18
+ '計畫資料管理系統/內容區',
19
+ '計畫資料管理系統/內容區/另存按鈕',
20
+ '計畫資料管理系統/內容區/刪除按鈕',
21
+ '計畫資料管理系統/內容區/查詢',
22
+ // '計畫資料管理系統/內容區/查詢/關鍵字功能',
23
+ '計畫資料管理系統/內容區/查詢/分類功能',
24
+ '計畫資料管理系統/內容區/查詢/計畫功能',
25
+ '計畫資料管理系統/內容區/查詢/欄位功能',
26
+ '輔助參考文獻系統',
27
+ '輔助參考文獻系統/主選單區',
28
+ '需求管理系統',
29
+ '需求管理系統/主選單區',
30
+ '需求管理系統/內容區',
31
+ '需求管理系統/內容區/編輯按鈕',
32
+ '知識管理系統',
33
+ '知識管理系統/主選單區',
34
+ '知識管理系統/內容區',
35
+ '知識管理系統/內容區/編輯按鈕',
36
+ 'GIS(2D)',
37
+ 'GIS(2D)/主選單區',
38
+ '模板下載',
39
+ '模板下載/主選單區',
40
+ '批次上傳系統',
41
+ '批次上傳系統/主選單區',
42
+ 'API管理系統',
43
+ 'API管理系統/主選單區',
44
+ '後台管理系統',
45
+ '後台管理系統/主選單區',
46
+ ]
47
+ rs = map(rs, (key, k) => {
48
+ let v = ds.targets.funNew({
49
+ description: key,
50
+ })
51
+ v.id = key
52
+ return v
53
+ })
54
+ await woItems.targets.delAll()
55
+ await woItems.targets.insert(rs)
56
+
57
+
58
+ rs = [
59
+ ['L0權限群組', '普通瀏覽者用之權限群組',
60
+ `{ "___all___": { "show": "n", "active": "n" },
61
+ "主要資訊": { "show": "y", "active": "y" },
62
+ "主要資訊/主選單區": { "show": "y", "active": "y" },
63
+ "計畫資料管理系統": { "show": "y", "active": "y" },
64
+ "計畫資料管理系統/主選單區": { "show": "y", "active": "y" },
65
+ "計畫資料管理系統/內容區": { "show": "y", "active": "y" },
66
+ "需求管理系統": { "show": "y", "active": "y" },
67
+ "需求管理系統/主選單區": { "show": "y", "active": "y" },
68
+ "知識管理系統": { "show": "y", "active": "y" },
69
+ "知識管理系統/主選單區": { "show": "y", "active": "y" },
70
+ "GIS": { "show": "y", "active": "y" },
71
+ "GIS/主選單區": { "show": "y", "active": "y" },
72
+ "模板下載": { "show": "y", "active": "y" },
73
+ "模板下載/主選單區": { "show": "y", "active": "y" },
74
+ }`],
75
+ ['L1權限群組', '一般使用者用之權限群組',
76
+ `{ "___all___": { "show": "n", "active": "n" },
77
+ "主要資訊": { "show": "y", "active": "y" },
78
+ "主要資訊/主選單區": { "show": "y", "active": "y" },
79
+ "計畫資料管理系統": { "show": "y", "active": "y" },
80
+ "計畫資料管理系統/主選單區": { "show": "y", "active": "y" },
81
+ "計畫資料管理系統/內容區": { "show": "y", "active": "y" },
82
+ "計畫資料管理系統/內容區/編輯按鈕": { "show": "y", "active": "n" },
83
+ "輔助參考文獻系統": { "show": "y", "active": "y" },
84
+ "輔助參考文獻系統/主選單區": { "show": "y", "active": "y" },
85
+ "需求管理系統": { "show": "y", "active": "y" },
86
+ "需求管理系統/主選單區": { "show": "y", "active": "y" },
87
+ "需求管理系統/內容區": { "show": "y", "active": "y" },
88
+ "需求管理系統/內容區/編輯按鈕": { "show": "y", "active": "n" },
89
+ "知識管理系統": { "show": "y", "active": "y" },
90
+ "知識管理系統/主選單區": { "show": "y", "active": "y" },
91
+ "知識管理系統/內容區": { "show": "y", "active": "y" },
92
+ "知識管理系統/內容區/編輯按鈕": { "show": "y", "active": "n" },
93
+ "GIS": { "show": "y", "active": "y" },
94
+ "GIS/主選單區": { "show": "y", "active": "y" },
95
+ "模板下載": { "show": "y", "active": "y" },
96
+ "模板下載/主選單區": { "show": "y", "active": "y" },
97
+ }`],
98
+ ['L2權限群組', '系統管理者用之權限群組',
99
+ `{ "___all___": { "show": "y", "active": "y" } }`],
100
+ ]
101
+ rs = map(rs, ([name, description, crules], k) => {
102
+ let v = ds.ruleGroups.funNew({
103
+ userId: 'id-for-admin',
104
+ name,
105
+ description,
106
+ crules,
107
+ })
108
+ v.id = `id-for-${name}`
109
+ v.order = k
110
+ return v
111
+ })
112
+ await woItems.ruleGroups.delAll()
113
+ await woItems.ruleGroups.insert(rs)
114
+
115
+
116
+ rs = [
117
+ ['viewer', '普通瀏覽者', 'id-for-L0權限群組'],
118
+ ['basic', '一般使用者', 'id-for-L1權限群組'],
119
+ ['admin', '系統管理者', 'id-for-L2權限群組'],
120
+ ]
121
+ rs = map(rs, ([key, name, ruleGroupsIds], k) => {
122
+ let v = ds.users.funNew({
123
+ userId: 'id-for-admin',
124
+ name,
125
+ email: `${key}@example.com`,
126
+ ruleGroupsIds,
127
+ })
128
+ v.id = `id-for-${key}`
129
+ if (key === 'admin') {
130
+ v.isAdmin = 'y'
131
+ }
132
+ return v
133
+ })
134
+ await woItems.users.delAll()
135
+ await woItems.users.insert(rs)
136
+
137
+
138
+ }
139
+
140
+ initialData()
141
+ .catch((err) => {
142
+ console.log('initialData catch', err)
143
+ })
144
+
145
+
146
+ //重建資料庫
147
+ //node --experimental-modules --es-module-specifier-resolution=node g.mInitialData.mjs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-web-perm",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "main": "dist/w-web-perm.umd.js",
5
5
  "dependencies": {
6
6
  "@mdi/js": "^7.2.96",
package/src/main.js CHANGED
@@ -1,9 +1,5 @@
1
- import get from 'lodash/get'
2
- // import '@babel/polyfill' //需提供Vuetify的Symbol等API
3
- // import 'core-js/stable' //需提供Vuetify的Symbol等API, 官網說使用transpileDependencies但不夠, 改用之前提到的@babel/polyfill會被提示已廢棄, 改使用給webpack的polyfill方式才行
4
- // import 'regenerator-runtime/runtime'
5
- // import 'intersection-observer' //需供Vuetify的Intersection Observer, 專案內有使用v-intersect才需引入, 而w-component-vue沒用v-intersect
6
1
  import Vue from 'vue'
2
+ import get from 'lodash/get'
7
3
  import WServHapiClient from 'w-serv-hapi/src/WServHapiClient.mjs'
8
4
  import WAlert from 'w-component-vue/src/components/WAlert.mjs'
9
5
  import domMutation from 'w-component-vue/src/js/domMutation.mjs'
@@ -14,10 +10,9 @@ import store from './store/index.mjs'
14
10
  import mVuetify from './plugins/mVuetify.mjs'
15
11
  import ui from './plugins/mUI.mjs'
16
12
  import mDataSelectorSchema from './plugins/mDataSelectorSchema.mjs'
17
- import mDataSupport from './plugins/mDataSupport.mjs'
13
+ // import mDataSupport from './plugins/mDataSupport.mjs'
18
14
  import * as s from './plugins/mShare.mjs'
19
15
  import ds from './schema/index.mjs'
20
- // console.log('globalState', globalState)
21
16
  // console.log('ds', ds)
22
17
 
23
18
 
@@ -36,15 +31,15 @@ Vue.prototype.$alert = function() {
36
31
  //dssm
37
32
  let dssm = mDataSelectorSchema(ds)
38
33
 
39
- //dspt
40
- let dspt = mDataSupport(Vue.prototype)
34
+ // //dspt
35
+ // let dspt = mDataSupport(Vue.prototype)
41
36
 
42
37
  //prototype
43
38
  Vue.prototype.$ui = ui
44
39
  Vue.prototype.$t = ui.getKpText
45
40
  Vue.prototype.$s = s
46
41
  Vue.prototype.$dssm = dssm
47
- Vue.prototype.$dspt = dspt
42
+ // Vue.prototype.$dspt = dspt
48
43
  // Vue.prototype.$ds = ds
49
44
  Vue.prototype.$dg = {}
50
45
 
package/src/perm.mjs CHANGED
@@ -8,6 +8,7 @@ import pmInvResolve from 'wsemi/src/pmInvResolve.mjs'
8
8
 
9
9
 
10
10
  function perm() {
11
+ //供外部系統引用並進行取得權限之操作
11
12
 
12
13
  //pmd
13
14
  let pmd = null
@@ -26,12 +27,6 @@ function perm() {
26
27
  throw new Error(`url does not include 'userId='`)
27
28
  }
28
29
 
29
- //thenExtractData
30
- let thenExtractData = get(opt, 'thenExtractData')
31
- if (!isbol(thenExtractData)) {
32
- thenExtractData = false //通過axios取數據時須給予true
33
- }
34
-
35
30
  //useAsync
36
31
  let useAsync = get(opt, 'useAsync')
37
32
  if (!isbol(useAsync)) {
@@ -52,7 +47,7 @@ function perm() {
52
47
 
53
48
  //get
54
49
  let pms = axios.get(url)
55
- pms = pmInvResolve(pms, { thenExtractData })
50
+ pms = pmInvResolve(pms, { thenExtractData: true })
56
51
  pms
57
52
  .then((res) => {
58
53
  // console.log('perm.getPerm then', res)
@@ -1,63 +1,20 @@
1
- // import min from 'lodash/min'
2
- // import size from 'lodash/size'
3
- // import take from 'lodash/take'
4
- // import isEqual from 'lodash/isEqual'
5
- // import uniq from 'lodash/uniq'
6
- // import set from 'lodash/set'
7
1
  // import get from 'lodash/get'
8
2
  // import each from 'lodash/each'
9
3
  // import map from 'lodash/map'
10
- // import filter from 'lodash/filter'
11
- // import last from 'lodash/last'
12
- // import split from 'lodash/split'
13
- // import join from 'lodash/join'
14
- // import drop from 'lodash/drop'
15
- // import dropRight from 'lodash/dropRight'
16
- // import groupBy from 'lodash/groupBy'
17
- // import sortBy from 'lodash/sortBy'
18
4
  // import cloneDeep from 'lodash/cloneDeep'
19
- // import cint from 'wsemi/src/cint.mjs'
20
- // import delay from 'wsemi/src/delay.mjs'
21
- // import isarr from 'wsemi/src/isarr.mjs'
22
5
  // import isestr from 'wsemi/src/isestr.mjs'
23
6
  // import isfun from 'wsemi/src/isfun.mjs'
24
7
  // import iseobj from 'wsemi/src/iseobj.mjs'
25
8
  // import isearr from 'wsemi/src/isearr.mjs'
26
- // import isEle from 'wsemi/src/isEle.mjs'
27
- // import strleft from 'wsemi/src/strleft.mjs'
28
- // import strdelleft from 'wsemi/src/strdelleft.mjs'
29
- // import sep from 'wsemi/src/sep.mjs'
30
- // import aes2str from 'wsemi/src/aes2str.mjs'
31
- // import str2aes from 'wsemi/src/str2aes.mjs'
32
- // import haskey from 'wsemi/src/haskey.mjs'
33
- // import genPm from 'wsemi/src/genPm.mjs'
34
- // import pmSeries from 'wsemi/src/pmSeries.mjs'
35
- // import waitFun from 'wsemi/src/waitFun.mjs'
36
- // import browserView from 'wsemi/src/browserView.mjs'
37
- // import arrHas from 'wsemi/src/arrHas.mjs'
38
- // import arrSort from 'wsemi/src/arrSort.mjs'
39
- // import arrInsert from 'wsemi/src/arrInsert.mjs'
40
- // import replace from 'wsemi/src/replace.mjs'
41
- // import timemsTZ2past from 'wsemi/src/timemsTZ2past.mjs'
42
- // import convertToTree from 'wsemi/src/convertToTree.mjs'
43
- // import html2picDyn from 'wsemi/src/html2picDyn.mjs'
44
- // import urlParse from 'wsemi/src/urlParse.mjs'
45
- // import domConvertToPicDyn from 'wsemi/src/domConvertToPicDyn.mjs'
46
- // import ltdtkeysheads2mat from 'wsemi/src/ltdtkeysheads2mat.mjs'
47
- // import downloadFileFromB64 from 'wsemi/src/downloadFileFromB64.mjs'
48
- // import downloadExcelFileFromDataDyn from 'wsemi/src/downloadExcelFileFromDataDyn.mjs'
49
- // import getFileAccept from 'wsemi/src/getFileAccept.mjs'
50
- // import downloadFileFromU8Arr from 'wsemi/src/downloadFileFromU8Arr.mjs'
9
+ // import cint from 'wsemi/src/cint.mjs'
51
10
 
52
11
 
53
- function mDataSupport(vo, opt = {}) {
12
+ function mDataSupport(vo) {
54
13
 
55
14
 
56
15
  return {
57
16
 
58
- // mdCheckKeyInd,
59
- // mdGetTextByKey,
60
- // mdGetTextByKeyIndAndKey,
17
+ // fun,
61
18
 
62
19
  }
63
20
  }
package/srv.mjs CHANGED
@@ -30,15 +30,7 @@ let opt = {
30
30
  }
31
31
 
32
32
  let getUserByToken = async (token) => {
33
- // if (token === '{token-for-application}') { //提供外部應用系統作為存取使用者
34
- // return {
35
- // id: 'id-for-application',
36
- // name: 'application',
37
- // email: 'admin@example.com',
38
- // isAdmin: 'y',
39
- // }
40
- // }
41
- if (token === 'token-for-sys-application') { //將主系統視為外部應用系統, 依據指定token作為授權使用者
33
+ if (token === '{token-for-application}') { //提供外部應用系統作為存取使用者
42
34
  return {
43
35
  id: 'id-for-application',
44
36
  name: 'application',
@@ -46,6 +38,14 @@ let getUserByToken = async (token) => {
46
38
  isAdmin: 'y',
47
39
  }
48
40
  }
41
+ // if (token === 'token-for-sys-application') { //將主系統視為外部應用系統, 依據指定token作為授權使用者
42
+ // return {
43
+ // id: 'id-for-application',
44
+ // name: 'application',
45
+ // email: 'admin@example.com',
46
+ // isAdmin: 'y',
47
+ // }
48
+ // }
49
49
  if (token === 'sys') { //開發階段w-ui-loginout自動給予browser使用者(且位於localhost)的token為sys
50
50
  return {
51
51
  id: 'id-for-admin',