sumba 2.26.0 → 2.26.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/index.js CHANGED
@@ -377,7 +377,7 @@ async function factory (pkgName) {
377
377
  return true
378
378
  }
379
379
 
380
- checkPathsByRoute = ({ paths = [], teamIds = [], guards = [] }) => {
380
+ checkPathsByRoute = ({ req, paths = [], teamIds = [], guards = [] }) => {
381
381
  const { includes } = this.app.lib.aneka
382
382
  const { outmatch } = this.app.lib
383
383
 
@@ -385,8 +385,10 @@ async function factory (pkgName) {
385
385
  const matchPath = outmatch(item.path)
386
386
  for (const path of paths) {
387
387
  if (matchPath(path)) {
388
- if (includes(teamIds, item.teamIds)) return item
389
- if (teamIds.length === 0) return item
388
+ if (item.methods.includes(req.method)) {
389
+ if (includes(teamIds, item.teamIds)) return item
390
+ if (teamIds.length === 0) return item
391
+ }
390
392
  }
391
393
  }
392
394
  }
package/lib/util.js CHANGED
@@ -122,28 +122,28 @@ export async function checkUserId (req, reply, source) {
122
122
  const globalGuards = guards.global.filter(item => item.siteIds.includes(req.site.id + ''))
123
123
  const localGuards = guards.local.filter(item => item.siteIds.includes(req.site.id + ''))
124
124
  // find anonymousPath
125
- anonymousPath = await this.checkPathsByRoute({ paths, guards: localGuards.filter(item => item.anonymous && !item.negation) })
125
+ anonymousPath = await this.checkPathsByRoute({ req, paths, guards: localGuards.filter(item => item.anonymous && !item.negation) })
126
126
  if (anonymousPath) {
127
- const neg = await this.checkPathsByRoute({ paths, guards: localGuards.filter(item => item.anonymous && item.negation) })
127
+ const neg = await this.checkPathsByRoute({ req, paths, guards: localGuards.filter(item => item.anonymous && item.negation) })
128
128
  if (neg) anonymousPath = undefined
129
129
  }
130
130
  if (!anonymousPath) {
131
- anonymousPath = await this.checkPathsByRoute({ paths, guards: globalGuards.filter(item => item.anonymous && !item.negation) })
131
+ anonymousPath = await this.checkPathsByRoute({ req, paths, guards: globalGuards.filter(item => item.anonymous && !item.negation) })
132
132
  if (anonymousPath) {
133
- const neg = await this.checkPathsByRoute({ paths, guards: globalGuards.filter(item => item.anonymous && item.negation) })
133
+ const neg = await this.checkPathsByRoute({ req, paths, guards: globalGuards.filter(item => item.anonymous && item.negation) })
134
134
  if (neg) anonymousPath = undefined
135
135
  }
136
136
  }
137
137
  // find securePath
138
- securePath = await this.checkPathsByRoute({ paths, guards: localGuards.filter(item => !item.anonymous && !item.negation) })
138
+ securePath = await this.checkPathsByRoute({ req, paths, guards: localGuards.filter(item => !item.anonymous && !item.negation) })
139
139
  if (securePath) {
140
- const neg = await this.checkPathsByRoute({ paths, guards: localGuards.filter(item => !item.anonymous && item.negation) })
140
+ const neg = await this.checkPathsByRoute({ req, paths, guards: localGuards.filter(item => !item.anonymous && item.negation) })
141
141
  if (neg) securePath = undefined
142
142
  }
143
143
  if (!securePath) {
144
- securePath = await this.checkPathsByRoute({ paths, guards: globalGuards.filter(item => !item.anonymous && !item.negation) })
144
+ securePath = await this.checkPathsByRoute({ req, paths, guards: globalGuards.filter(item => !item.anonymous && !item.negation) })
145
145
  if (securePath) {
146
- const neg = await this.checkPathsByRoute({ paths, guards: globalGuards.filter(item => !item.anonymous && item.negation) })
146
+ const neg = await this.checkPathsByRoute({ req, paths, guards: globalGuards.filter(item => !item.anonymous && item.negation) })
147
147
  if (neg) securePath = undefined
148
148
  }
149
149
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sumba",
3
- "version": "2.26.0",
3
+ "version": "2.26.1",
4
4
  "description": "Biz Suite for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-05-29
4
+
5
+ - [2.26.1] Bug fix in ```util.js```
6
+ - [2.26.1] Bug fix in ```checkPathsByRoute()```
7
+
3
8
  ## 2026-05-28
4
9
 
5
10
  - [2.26.0] Change hooks to be written in one ```hook.js``` file