sumba 2.27.1 → 2.27.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.
@@ -23,16 +23,16 @@ async function clearCacheUser (id, result) {
23
23
 
24
24
  async function applyModelGuard ({ model, q, teamIds, options }) {
25
25
  const { get, set, orderBy, intersection, without } = this.app.lib._
26
- const { include } = this.app.lib.aneka
26
+ const { includes } = this.app.lib.aneka
27
27
  const { req } = options
28
28
  const results = []
29
29
 
30
30
  const guards = await this.getModelGuards()
31
31
  const columns = model.getNonVirtualProperties().map(prop => prop.name)
32
32
  const filterFn = item => {
33
- const bySiteId = item.siteIds.includes(req.site.id + '')
33
+ const bySiteId = item.siteIds ? item.siteIds.includes(req.site.id + '') : true
34
34
  const byModel = item.models.includes(model.name)
35
- const byTeamId = item.teamIds.length === 0 || include(item.teamIds, teamIds)
35
+ const byTeamId = item.teamIds ? includes(item.teamIds, teamIds) : true
36
36
  const byColumn = columns.includes(item.column)
37
37
  return bySiteId && byModel && byTeamId && byColumn
38
38
  }
@@ -54,7 +54,8 @@ async function applyModelGuard ({ model, q, teamIds, options }) {
54
54
  for (const item of items) {
55
55
  newValues.push(...item.value)
56
56
  }
57
- if (newValues.length > 0) values = intersection(values, newValues)
57
+ if (values.length === 0) values = newValues
58
+ else if (newValues.length > 0) values = intersection(values, newValues)
58
59
  items = guards.local.filter(item => item.column === col && item.negation)
59
60
  for (const item of items) {
60
61
  values = without(values, ...item.value)
@@ -69,15 +70,15 @@ async function applyModelGuard ({ model, q, teamIds, options }) {
69
70
 
70
71
  export async function applyAttribGuard ({ model, teamIds, options }) {
71
72
  const { uniq } = this.app.lib._
72
- const { include } = this.app.lib.aneka
73
+ const { includes } = this.app.lib.aneka
73
74
  const { req } = options
74
75
  const results = []
75
76
 
76
77
  const guards = await this.getAttribGuards()
77
78
  const filterFn = item => {
78
- const bySiteId = item.siteIds.includes(req.site.id + '')
79
+ const bySiteId = item.siteIds ? item.siteIds.includes(req.site.id + '') : true
79
80
  const byModel = item.models.includes(model.name)
80
- const byTeamId = item.teamIds.length === 0 || include(item.teamIds, teamIds)
81
+ const byTeamId = item.teamIds ? includes(item.teamIds, teamIds) : true
81
82
  return bySiteId && byModel && byTeamId
82
83
  }
83
84
 
@@ -1,32 +1,56 @@
1
1
  async function user ({ req } = {}) {
2
2
  const { merge } = this.app.lib._
3
+ const { routePath } = this.app.waibu
3
4
  const details = {
5
+ layout: [
6
+ { name: 'meta', fields: ['id:3', 'createdAt:3', 'updatedAt:3', 'status:3'] },
7
+ { name: 'account', fields: ['username:3', 'email:3', 'provider:3', 'password:3', 'firstName:3', 'lastName:3', 'apiKey:6'] },
8
+ { name: 'address', fields: ['address1:12', 'address2:12', 'city:6-md 8-sm', 'zipCode:2-md 4-sm', 'provinceState:4-md', 'country:6-md', 'phone:6-md', 'website:12'] },
9
+ { name: 'socialMedia', fields: ['socX:3-md 6-sm', 'socInstagram:3-md 6-sm', 'socFacebook:3-md 6-sm', 'socLinkedIn:3-md 6-sm'] }
10
+ ],
4
11
  forceVisible: ['password', 'token'],
5
12
  format: {
6
13
  password: function (val, rec) {
7
- return `<a href="waibuAdmin:/site/reset-user-password?username=${rec.username}">${req.t('resetPassword')}</a>`
14
+ return '*************'
15
+ // return `<a href="waibuAdmin:/site/reset-user-password?username=${rec.username}">${req.t('resetPassword')}</a>`
8
16
  }
9
17
  },
10
18
  widget: {
19
+ username: {
20
+ attr: {
21
+ id: 'fusername'
22
+ }
23
+ },
11
24
  password: {
12
- component: 'form-plaintext'
25
+ component: 'form-plaintext',
26
+ addons: [{
27
+ attr: {
28
+ 'x-data': true,
29
+ '@click': `location.href='${routePath('waibuAdmin:/site/reset-user-password?username=')}' + document.getElementById('fusername').textContent`,
30
+ icon: 'arrowsRepeat'
31
+ },
32
+ type: 'button',
33
+ position: 'append'
34
+ }]
35
+ },
36
+ apiKey: {
37
+ attr: {
38
+ id: 'fapi-key',
39
+ text: 'truncate'
40
+ },
41
+ addons: [{
42
+ attr: {
43
+ 'x-data': true,
44
+ '@click': "await wbs.copyToClipboard('#fapi-key', true)",
45
+ icon: 'copy'
46
+ },
47
+ type: 'button',
48
+ position: 'append'
49
+ }]
13
50
  }
14
51
  }
15
52
  }
16
53
  return {
17
- common: {
18
- layout: [
19
- { name: 'meta', fields: ['id:3', 'createdAt:3', 'updatedAt:3', 'status:3'] },
20
- { name: 'account', fields: ['username:3', 'email:3', 'provider:3', 'password:3', 'firstName:3', 'lastName:3'] },
21
- { name: 'address', fields: ['address1:12', 'address2:12', 'city:6-md 8-sm', 'zipCode:2-md 4-sm', 'provinceState:4-md', 'country:6-md', 'phone:6-md', 'website:12'] },
22
- { name: 'socialMedia', fields: ['socX:3-md 6-sm', 'socInstagram:3-md 6-sm', 'socFacebook:3-md 6-sm', 'socLinkedIn:3-md 6-sm'] }
23
- ],
24
- widget: {
25
- token: {
26
- component: 'form-plaintext'
27
- }
28
- }
29
- },
30
54
  view: {
31
55
  list: {
32
56
  qs: {
@@ -44,6 +68,12 @@ async function user ({ req } = {}) {
44
68
  },
45
69
  details,
46
70
  add: {
71
+ layout: [
72
+ { name: 'meta', fields: ['id:3', 'createdAt:3', 'updatedAt:3', 'status:3'] },
73
+ { name: 'account', fields: ['username:4', 'email:4', 'password:4', 'firstName:6', 'lastName:6'] },
74
+ { name: 'address', fields: ['address1:12', 'address2:12', 'city:6-md 8-sm', 'zipCode:2-md 4-sm', 'provinceState:4-md', 'country:6-md', 'phone:6-md', 'website:12'] },
75
+ { name: 'socialMedia', fields: ['socX:3-md 6-sm', 'socInstagram:3-md 6-sm', 'socFacebook:3-md 6-sm', 'socLinkedIn:3-md 6-sm'] }
76
+ ],
47
77
  forceVisible: ['password'],
48
78
  hidden: ['id', 'createdAt', 'updatedAt', 'provider']
49
79
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sumba",
3
- "version": "2.27.1",
3
+ "version": "2.27.3",
4
4
  "description": "Biz Suite for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-06-01
4
+
5
+ - [2.27.3] Bug fix in ```user.js``` schema
6
+
3
7
  ## 2026-05-30
4
8
 
5
9
  - [2.27.0] Move all ```sumbaUser``` hooks to model hooks
@@ -7,6 +11,7 @@
7
11
  - [2.27.0] Bug fix in ```create-new-site.js```
8
12
  - [2.27.0] Bug fix in ```team-user.json``` fixture
9
13
  - [2.27.1] Bug fix in ```util.pathToCheck()```
14
+ - [2.27.2] Bug fix in ```hook.js```
10
15
 
11
16
  ## 2026-05-29
12
17