@opengis/fastify-table 1.4.42 → 1.4.44

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "1.4.42",
3
+ "version": "1.4.44",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [
@@ -11,7 +11,7 @@ export default async function getMeta(opt, nocache) {
11
11
 
12
12
  if (pg?.options?.database && data[pg.options.database]?.[table] && !nocache) return data[pg.options.database][table];
13
13
 
14
- if (!pg?.tlist?.includes(table)) {
14
+ if (!pg?.tlist?.includes(table) && !pg?.tlist?.includes(table?.replace?.(/"/g, ''))) {
15
15
  return { error: `${table} - not found`, status: 400 };
16
16
  }
17
17
 
@@ -18,6 +18,9 @@ export default function checkPolicy(req, reply) {
18
18
  const {
19
19
  originalUrl: path, hostname, query, params, headers, method, session, routeOptions, unittest,
20
20
  } = req;
21
+
22
+ if (config.local || unittest) { return null; }
23
+
21
24
  const body = JSON.stringify(req?.body || {}).substring(30);
22
25
 
23
26
  const isAdmin = process.env.NODE_ENV === 'admin' || hostname.split(':').shift() === config.adminDomain || config.admin || hostname.startsWith('admin');
@@ -75,7 +78,7 @@ export default function checkPolicy(req, reply) {
75
78
  }
76
79
 
77
80
  /* === policy: public === */
78
- if (policy.includes('public') || skipCheckPolicy(path) || !config.pg || config.auth?.disable || config.local || config.debug || unittest) {
81
+ if (policy.includes('public') || skipCheckPolicy(path) || !config.pg || config.auth?.disable || config.local || config.debug) {
79
82
  return null;
80
83
  }
81
84
 
@@ -1,4 +1,6 @@
1
- import { logger, dataInsert, pgClients } from '../../../../utils.js';
1
+ import {
2
+ config, logger, dataInsert, pgClients,
3
+ } from '../../../../utils.js';
2
4
 
3
5
  function checkValueType(val) {
4
6
  if (val && typeof val === 'object') {
@@ -15,7 +17,7 @@ export default async function postAppSettings({
15
17
  }, reply) {
16
18
  const { uid } = user;
17
19
 
18
- if ((!params.entity || params.entity === 'app') && !user?.user_type?.includes?.('admin')) {
20
+ if ((!params.entity || params.entity === 'app') && !user?.user_type?.includes?.('admin') && !config.local) {
19
21
  return reply.status(403).send('access restricted');
20
22
  }
21
23