sumba 2.32.4 → 2.33.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/extend/bajo/hook.js +7 -2
- package/extend/bajo/intl/en-US.json +2 -1
- package/extend/bajo/intl/id.json +2 -1
- package/extend/dobo/feature/country.js +1 -1
- package/extend/dobo/feature/site-id.js +3 -2
- package/extend/waibuDb/schema/site-setting.js +15 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/x/site-setting/@action.js +12 -0
- package/extend/waibuMpa/route/help/trouble-tickets/details/@id.js +1 -1
- package/index.js +3 -2
- package/lib/get-site.js +1 -1
- package/lib/get-user.js +4 -2
- package/package.json +1 -1
- package/wiki/CHANGES.md +8 -0
package/extend/bajo/hook.js
CHANGED
|
@@ -40,8 +40,13 @@ async function applyModelGuard ({ model, q, teamIds, options }) {
|
|
|
40
40
|
for (const field of fields) {
|
|
41
41
|
if (!model.getNonVirtualProperties(true).includes(field)) continue // or, should it throws exception instead?
|
|
42
42
|
const opValue = req.getSetting(`sumba:modelGuard.${field}`, {})
|
|
43
|
-
for (const op of ['in', 'nin']) {
|
|
44
|
-
if (
|
|
43
|
+
for (const op of ['in', 'nin', 'inOrNull']) {
|
|
44
|
+
if (isEmpty(opValue[op]) || !isArray(opValue[op])) continue
|
|
45
|
+
if (op === 'inOrNull') {
|
|
46
|
+
const val = set({}, field, set({}, '$in', opValue[op]))
|
|
47
|
+
const nl = set({}, field, { $eq: null })
|
|
48
|
+
results.push({ $or: [val, nl] })
|
|
49
|
+
} else results.push(set({}, field, set({}, '$' + op, opValue[op])))
|
|
45
50
|
}
|
|
46
51
|
const prop = model.getProperty(field)
|
|
47
52
|
const items = rules.filter(item => item.field === field)
|
package/extend/bajo/intl/id.json
CHANGED
|
@@ -7,7 +7,7 @@ async function country (opts = {}) {
|
|
|
7
7
|
type: 'string',
|
|
8
8
|
maxLength: 2,
|
|
9
9
|
index: opts.index ?? true,
|
|
10
|
-
required: opts.required,
|
|
10
|
+
required: opts.required ?? true,
|
|
11
11
|
values: 'sumba:getCountriesValues',
|
|
12
12
|
rules: opts.enforceRule ? ['uppercase', { rule: 'length', params: 2 }] : [],
|
|
13
13
|
rulesMsg: opts.enforceRule ? { 'any.only': 'validCountryCodeRequired' } : undefined
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const action = {
|
|
2
|
+
method: ['GET', 'POST'],
|
|
3
|
+
title: 'siteSetting',
|
|
4
|
+
xSite: true,
|
|
5
|
+
handler: async function (req, reply) {
|
|
6
|
+
const { importModule } = this.app.bajo
|
|
7
|
+
const crudSkel = await importModule('waibuAdmin:/lib/crud-skel.js')
|
|
8
|
+
return await crudSkel.call(this, 'SumbaSiteSetting', req, reply)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default action
|
|
@@ -29,7 +29,7 @@ const id = {
|
|
|
29
29
|
schema.view.format = {
|
|
30
30
|
createdAt: async function (val, rec) {
|
|
31
31
|
const message = this.app.bajoMarkdown ? this.app.bajoMarkdown.parseContent(rec.message) : rec.message
|
|
32
|
-
const isMe = rec.userId === req.user.id
|
|
32
|
+
const isMe = rec.userId === req.user.id + ''
|
|
33
33
|
const sentence = `<c:div margin="bottom-3"><c:badge background="color:${isMe ? 'primary' : 'secondary'}" t:content="${isMe ? 'you' : 'us'}" /> <small>${req.format(val, 'datetime')}</small></c:div>`
|
|
34
34
|
return (await this.component.buildSentence(sentence)) + message
|
|
35
35
|
}
|
package/index.js
CHANGED
|
@@ -351,6 +351,7 @@ async function factory (pkgName) {
|
|
|
351
351
|
title: 'xSite',
|
|
352
352
|
children: [
|
|
353
353
|
{ title: 'allSites', href: `waibuAdmin:/${prefix}/x/site/:action`, params },
|
|
354
|
+
{ title: 'siteSetting', href: `waibuAdmin:/${prefix}/x/site-setting/:action`, params },
|
|
354
355
|
sessionMenu
|
|
355
356
|
]
|
|
356
357
|
})
|
|
@@ -744,7 +745,6 @@ async function factory (pkgName) {
|
|
|
744
745
|
const { merge, isEmpty, camelCase, get } = this.app.lib._
|
|
745
746
|
const { routePath } = this.app.waibu
|
|
746
747
|
const userId = get(req, 'session.userId')
|
|
747
|
-
|
|
748
748
|
const setUser = async () => {
|
|
749
749
|
if (!userId) return
|
|
750
750
|
try {
|
|
@@ -805,7 +805,8 @@ async function factory (pkgName) {
|
|
|
805
805
|
checkXSite = async (req, reply) => {
|
|
806
806
|
const { get } = this.app.lib._
|
|
807
807
|
if (!this.config.multiSite.enabled) return
|
|
808
|
-
|
|
808
|
+
const config = get(req, 'routeOptions.config')
|
|
809
|
+
if (!get(config, 'xSite') || ['/dashboard'].includes(config.pathSrc)) return
|
|
809
810
|
if (!get(req, 'user.isXSiteAdmin')) throw this.error('accessDenied', { statusCode: 403 })
|
|
810
811
|
}
|
|
811
812
|
|
package/lib/get-site.js
CHANGED
|
@@ -23,7 +23,7 @@ async function getSite (input, byId = false) {
|
|
|
23
23
|
}
|
|
24
24
|
site.setting = defaultsDeep({}, nsSetting, defSetting)
|
|
25
25
|
// additional fields
|
|
26
|
-
const country = await this.app.dobo.getModel('CdbCountry').getRecord(site.country, {
|
|
26
|
+
const country = await this.app.dobo.getModel('CdbCountry').getRecord(site.country, { noMagic: true })
|
|
27
27
|
site.countryName = (country ?? {}).name ?? site.country
|
|
28
28
|
}
|
|
29
29
|
|
package/lib/get-user.js
CHANGED
|
@@ -2,12 +2,14 @@ export async function mergeTeam (user, req) {
|
|
|
2
2
|
const { map, pick } = this.app.lib._
|
|
3
3
|
const { getModel } = this.app.dobo
|
|
4
4
|
user.teams = []
|
|
5
|
-
const query = { userId: user.id, siteId: user.siteId, status: 'ACTIVE' }
|
|
5
|
+
const query = { userId: user.id + '', siteId: user.siteId, status: 'ACTIVE' }
|
|
6
6
|
let mdl = getModel('SumbaTeamUser')
|
|
7
7
|
const userTeam = await mdl.findAllRecord({ query })
|
|
8
8
|
if (userTeam.length === 0) return
|
|
9
9
|
delete query.userId
|
|
10
|
-
|
|
10
|
+
const idProp = mdl.getProperty('id')
|
|
11
|
+
const $in = userTeam.map(item => ['integer', 'smallint'].includes(idProp.type) ? parseInt(item.teamId) : item.teamId)
|
|
12
|
+
query.id = { $in }
|
|
11
13
|
mdl = getModel('SumbaTeam')
|
|
12
14
|
const teams = await mdl.findAllRecord({ query })
|
|
13
15
|
if (teams.length > 0) {
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-06-17
|
|
4
|
+
|
|
5
|
+
- [2.33.0] Add ```Site Setting``` in ```Cross-Site```
|
|
6
|
+
- [2.33.0] Bug fix in ```hook.js```
|
|
7
|
+
- [2.33.0] Bug fix in ```sumba:siteId``` feature
|
|
8
|
+
- [2.33.1] Bug fix in ```checkUser()```, ```checkTeam()``` & ```checkXSite()```
|
|
9
|
+
- [2.33.1] Bug fix in ```sumba:country``` feature
|
|
10
|
+
|
|
3
11
|
## 2026-06-15
|
|
4
12
|
|
|
5
13
|
- [2.32.3] Bug fix in ```hook.js```
|