@opengis/fastify-table 1.2.15 → 1.2.16

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.2.15",
3
+ "version": "1.2.16",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [
@@ -13,7 +13,7 @@ import applyHook from '../../hook/funcs/applyHook.js';
13
13
  * @returns { scope: String, actions: String[], query: String }
14
14
  */
15
15
 
16
- const q = `select a.route_id as id, coalesce(d.actions, b.actions, array['view']) as actions, b.scope, c.role_id
16
+ const q = `select a.route_id as id, d.actions as user_roles, d.actions as role_actions, coalesce(b.actions, array['view']) as interface_actions, b.scope, c.role_id
17
17
  from admin.routes a
18
18
  left join admin.role_access b on
19
19
  a.route_id=b.route_id
@@ -73,7 +73,10 @@ export default async function getAccess({ table, user = {} }) {
73
73
  : {};
74
74
 
75
75
  const query = userAccess?.scope === 'my' ? `uid='${uid}'` : '1=1';
76
- const actions = userAccess?.actions?.filter?.((el, idx, arr) => arr.indexOf(el) === idx && tableActions.includes(el));
76
+ const actions = userAccess?.interface_actions
77
+ ?.filter?.((el, idx, arr) => arr.indexOf(el) === idx)
78
+ ?.filter(el => userAccess?.role_actions?.length ? userAccess?.role_actions.includes(el) : true)
79
+ ?.filter(el => tableActions.includes(el));
77
80
  return {
78
81
  scope: userAccess?.scope,
79
82
  roles: userAccess?.roles,