w-web-perm 1.0.1 → 1.0.2

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 (37) hide show
  1. package/README.md +58 -0
  2. package/dist/css/{chunk-vendors.65775501.css → chunk-vendors.1c6c57f9.css} +1 -1
  3. package/dist/index.tmp +1 -1
  4. package/dist/js/app-legacy.317de647.js +2 -0
  5. package/dist/js/app-legacy.317de647.js.map +1 -0
  6. package/dist/js/app.94cdbe9a.js +2 -0
  7. package/dist/js/app.94cdbe9a.js.map +1 -0
  8. package/dist/js/chunk-vendors-legacy.a074d0c0.js +13 -0
  9. package/dist/js/chunk-vendors-legacy.a074d0c0.js.map +1 -0
  10. package/dist/js/chunk-vendors.a074d0c0.js +13 -0
  11. package/dist/js/chunk-vendors.a074d0c0.js.map +1 -0
  12. package/dist/w-web-perm.umd.js +2 -2
  13. package/dist/w-web-perm.umd.js.map +1 -1
  14. package/docs/WWebPerm.html +1 -1
  15. package/docs/WWebPerm.mjs.html +58 -8
  16. package/docs/index.html +1 -1
  17. package/package.json +4 -3
  18. package/server/WWebPerm.mjs +57 -7
  19. package/src/components/LayoutContentGroups.vue +3 -2
  20. package/src/components/LayoutContentTargets.vue +9 -2
  21. package/src/components/VeUser.vue +5 -4
  22. package/src/components/ruleGroup.vue +6 -28
  23. package/src/perm.mjs +91 -48
  24. package/src/plugins/mShare.mjs +25 -5
  25. package/src/schema/tables/ruleGroups.mjs +1 -2
  26. package/src/schema/tables/targets.mjs +21 -28
  27. package/src/store/mutations.mjs +1 -1
  28. package/srv.mjs +24 -7
  29. package/tableTags-web-perm.json +1 -1
  30. package/dist/js/app-legacy.a31aa3a9.js +0 -2
  31. package/dist/js/app-legacy.a31aa3a9.js.map +0 -1
  32. package/dist/js/app.a31aa3a9.js +0 -2
  33. package/dist/js/app.a31aa3a9.js.map +0 -1
  34. package/dist/js/chunk-vendors-legacy.f5f1a231.js +0 -13
  35. package/dist/js/chunk-vendors-legacy.f5f1a231.js.map +0 -1
  36. package/dist/js/chunk-vendors.f5f1a231.js +0 -13
  37. package/dist/js/chunk-vendors.f5f1a231.js.map +0 -1
package/README.md CHANGED
@@ -20,5 +20,63 @@ npm i w-web-perm
20
20
  #### Example for server:
21
21
  > **Link:** [[dev source code](https://github.com/yuda-lyu/w-web-perm/blob/master/srv.mjs)]
22
22
  ```alias
23
+ import WOrm from 'w-orm-mongodb/src/WOrmMongodb.mjs' //自行選擇引用ORM, 使用Mongodb測試
24
+ import WWebPerm from './server/WWebPerm.mjs'
25
+ import getSettings from './g.getSettings.mjs'
26
+
27
+
28
+ //st
29
+ let st = getSettings()
30
+
31
+ let url = `mongodb://${st.dbUsername}:${st.dbPassword}@${st.dbIP}:${st.dbPort}` //使用Mongodb測試
32
+ let db = st.dbName
33
+ let opt = {
34
+
35
+ bCheckUser: false,
36
+ getUserById: null,
37
+ bExcludeWhenNotAdmin: false,
38
+
39
+ serverPort: 11006,
40
+ subfolder: '', //mperm
41
+
42
+ webName: {
43
+ 'eng': 'Permission Service',
44
+ 'cht': '權限管理系統',
45
+ },
46
+ webDescription: {
47
+ 'eng': 'A web service package for user permissions and management targets.',
48
+ 'cht': 'A web service package for user permissions and management targets.',
49
+ },
50
+ webLogo: '{base64 img}',
51
+
52
+ }
53
+
54
+ let getUserByToken = async (token) => {
55
+ if (token === '{token-for-application}') { //提供外部應用系統作為存取使用者
56
+ return {
57
+ id: 'id-for-application',
58
+ name: 'application',
59
+ email: 'admin@example.com',
60
+ isAdmin: 'y',
61
+ }
62
+ }
63
+ if (token === 'sys') { //開發階段w-ui-loginout自動給予browser使用者(且位於localhost)的token為sys
64
+ return {
65
+ id: 'id-for-admin',
66
+ name: 'tester',
67
+ email: 'admin@example.com',
68
+ isAdmin: 'y',
69
+ }
70
+ }
71
+ console.log('invalid token', token)
72
+ return {}
73
+ }
74
+
75
+ //WWebPerm
76
+ let instWWebPerm = WWebPerm(WOrm, url, db, getUserByToken, opt)
77
+
78
+ instWWebPerm.on('error', (err) => {
79
+ console.log(err)
80
+ })
23
81
 
24
82
  ```