@opengis/admin 0.2.124 → 0.2.126
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@opengis/admin",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.126",
|
4
4
|
"description": "This project Softpro Admin",
|
5
5
|
"main": "dist/admin.js",
|
6
6
|
"type": "module",
|
@@ -48,7 +48,7 @@
|
|
48
48
|
"@fullcalendar/vue3": "^6.1.15",
|
49
49
|
"@opengis/fastify-auth": "^1.0.70",
|
50
50
|
"@opengis/fastify-file": "^1.0.42",
|
51
|
-
"@opengis/fastify-table": "^1.2.
|
51
|
+
"@opengis/fastify-table": "^1.2.12",
|
52
52
|
"@opengis/v3-core": "^0.3.45",
|
53
53
|
"@opengis/v3-filter": "^0.0.71",
|
54
54
|
"@tabler/icons-vue": "^3.28.1",
|
@@ -0,0 +1 @@
|
|
1
|
+
select 1
|
package/server/plugins/hook.js
CHANGED
@@ -89,14 +89,14 @@ export default async function plugin(fastify) {
|
|
89
89
|
printTemplates[el[0]] = settings;
|
90
90
|
});
|
91
91
|
if (client?.pk?.['admin.templates']) {
|
92
|
-
const arr = Object.keys(printTemplates || {}).map(el => ({ name: el, ...printTemplates?.[el] || {} }));
|
92
|
+
const arr = Object.keys(printTemplates || {}).map(el => ({ name: el, ...printTemplates?.[el] || {} })).filter(el => el.name && el.route && el.html);
|
93
93
|
|
94
94
|
const { rowsCount = 0 } = await pgClients.client.query(`delete from admin.templates where not (name=any($1::text[])) and type = 'demo'`, [arr.map(el => el.name)]);
|
95
95
|
console.log('delete deprecated templates', 'ok', rowsCount);
|
96
96
|
const { rowsCount: empty = 0 } = await pgClients.client.query('delete from admin.templates where body is null');
|
97
97
|
console.log('delete empty templates', 'ok', empty);
|
98
98
|
|
99
|
-
const q = arr.map(el => `insert into admin.templates(name, route_id, title, type, body) values ('${el.name.replace(/'/g, "''")}', '${el.route.replace(/'/g, "''")}', '${el.title.replace(/'/g, "''")}', 'demo', '${(el.html || '').replace(/'/g, "''")}') on conflict(name, type) do update set route_id=excluded.route_id, title=excluded.title`).join(';');
|
99
|
+
const q = arr.map(el => `insert into admin.templates(name, route_id, title, type, body) values ('${el.name.replace(/'/g, "''")}', '${el.route.replace(/'/g, "''")}', '${(el.title || el.name).replace(/'/g, "''")}', 'demo', '${(el.html || '').replace(/'/g, "''")}') on conflict(name, type) do update set route_id=excluded.route_id, title=excluded.title`).join(';');
|
100
100
|
const res = await pgClients.client.query(q);
|
101
101
|
console.log('insert print templates', 'ok', (Array.isArray(res) ? res : [res]).length);
|
102
102
|
}
|
@@ -36,7 +36,7 @@ export default async function adminMenu({ user = {}, session, pg = pgClients.cli
|
|
36
36
|
|
37
37
|
// update user access
|
38
38
|
|
39
|
-
if (session && user?.uid && !
|
39
|
+
if (session && user?.uid && !user.user_type?.includes?.('admin') && !user.type?.includes?.('admin') && pg.pk['admin.role_access']) {
|
40
40
|
const { type, gl = [], routes = [] } = await pg.query(`select user_type as type, b.gl,routes from admin.users a
|
41
41
|
left join lateral (
|
42
42
|
select array_agg(role_id) as gl from admin.user_roles
|