@opengis/fastify-table 1.2.15 → 1.2.17
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
|
@@ -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,
|
|
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?.
|
|
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,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
const emailReg = /(?:[a-
|
|
2
|
+
const emailReg = /(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/g;
|
|
3
3
|
|
|
4
4
|
function checkField(key, val, options, idx) {
|
|
5
5
|
// validators: [required]
|
|
@@ -49,5 +49,5 @@ function checkBody({ body = {}, arr = [], idx }) {
|
|
|
49
49
|
|
|
50
50
|
export default function validateData({ body = {}, schema = {} }) {
|
|
51
51
|
const res = checkBody({ body, arr: Object.keys(schema).map(key => ({ ...schema[key], key })) });
|
|
52
|
-
return res;
|
|
52
|
+
return res;
|
|
53
53
|
}
|